<html>
<head>
  <title>Evernote Export</title>
  <basefont face="微软雅黑" size="2" />
  <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
  <meta name="exporter-version" content="YXBJ Windows/600646 (zh-CN, DDL); Windows/6.1.1 (Win64);"/>
  <meta name="content-class" content="yinxiang.markdown"/>
  <style>
    body, td {
      font-family: 微软雅黑;
      font-size: 10pt;
    }
  </style>
</head>
<body>
<a name="1216"/>

<div><span><div style="font-size: 14px; margin: 0; padding: 0; width: 100%;"><h4 style="line-height: 160%; box-sizing: content-box; font-size: 20px; color: #333;">事前准备</h4>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">建立一个存储三国英雄的hero表：<br/>
<img src="25-加锁分析_files/Image.png" type="image/png" data-filename="Image.png"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">然后向这个表里插入几条记录：<br/>
<img src="25-加锁分析_files/Image [1].png" type="image/png" data-filename="Image.png"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">然后现在hero表就有了两个索引（一个二级索引，一个聚簇索引），示意图如下：<br/>
<img src="25-加锁分析_files/1.jpg" type="image/jpeg" data-filename="1.jpg"/></p>
<h4 style="line-height: 160%; box-sizing: content-box; font-size: 20px; color: #333;">语句加锁分析的前置条件</h4>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">“XXX语句该加什么锁”本身就是个伪命题，一条语句需要加的锁受到很多条件制约，比方说：</p>
<ul style="line-height: 160%; box-sizing: content-box; display: block; list-style-type: disc; padding-left: 30px; margin: 6px 0 10px; color: #333;">
<li style="line-height: 160%; box-sizing: content-box; position: relative;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">事务的隔离级别</strong></li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">语句执行时使用的索引（聚簇索引、唯一二级索引、普通二级索引、未使用索引）</strong></li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">查询条件</strong></li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">具体执行的语句类型</strong></li>
</ul>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">加锁的目的是为了解决并发事务执行过程中引起的<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">脏写、脏读、不可重复读、幻读</strong>。</p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">具体执行的语句类型，对于加锁分析可以分为3大类：</p>
<ul style="line-height: 160%; box-sizing: content-box; display: block; list-style-type: disc; padding-left: 30px; margin: 6px 0 10px; color: #333;">
<li style="line-height: 160%; box-sizing: content-box; position: relative;">快照读（普通的select语句）</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">锁定读、update、delete语句</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">insert语句</li>
</ul>
<h2 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 34px; border-bottom: 1px solid #dbdbdb; color: #333;">1 快照读（普通的select语句）</h2>
<h3 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 27px; color: #333;">1-1 Read Uncommitted隔离级别</h3>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">不加锁，直接读取记录的最新版本，可能发生<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">脏读、不可重复读和幻读</strong>问题。</p>
<h3 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 27px; color: #333;">1-2 Read Committed隔离级别</h3>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">不加锁，在每次执行普通的select语句时，都会生成一个<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">ReadView</strong>，读取版本链中对该事务的可见版本，这样解决了<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">脏读</strong>问题，但是没有解决<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">不可重复读</strong>和<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">幻读</strong>问题。</p>
<h3 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 27px; color: #333;">1-3 Repeatable Read隔离级别</h3>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">不加锁，只在第一次执行普通的select语句时，生成一个<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">ReadView</strong>，解决了<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">脏读、不可重复读和部分幻读</strong>问题。</p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">之所以说是部分幻读，主要是因为下面这个例子：<br/>
<img src="25-加锁分析_files/Image [2].png" type="image/png" data-filename="Image.png"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">在Repeatable Read隔离级别下，T1第一次执行普通的select语句时生成了一个<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">ReadView</strong>，之后T2向hero表中新插入了一条记录便提交了，<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">ReadView</strong>并不能阻止T1执行<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">update或者delete</strong>语句来改动这个新插入的记录（因为T2已经提交，改动该记录并不会造成阻塞），但是这样一来这条新记录的<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">trx_id</strong>隐藏列就变成了T1的<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">事务ID</strong>，之后T1中再使用普通的select语句去查询这条记录时就可以看到这条记录了，也就把这条记录返回给客户端了。因为这个特殊现象的存在，也可以认为InnoDB中<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">MVCC不能完完全全的禁止幻读</strong>。</p>
<h3 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 27px; color: #333;">1-4 Serializable隔离级别</h3>
<ul style="line-height: 160%; box-sizing: content-box; display: block; list-style-type: disc; padding-left: 30px; margin: 6px 0 10px; color: #333;">
<li style="line-height: 160%; box-sizing: content-box; position: relative;">在系统变量autocommit = 0时，即禁用自动提交时，普通的select语句会被转为<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">select ... ... lock in share mode</strong>语句，就是在读取记录前需要先获得记录的<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">S锁</strong>，具体的加锁情况和Repeatable Read隔离级别一样，下面分析。</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">在系统变量autocommit = 1时，即启用自动提交时，普通的select语句并不加锁，只利用MVCC生成一个<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">ReadView</strong>去读取记录。</li>
</ul>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">为什么在系统变量autocommit = 1时不加锁呢？因为启用自动提交意味着一个事务中只包含一条语句，一条语句就不存在<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">不可重复读、幻读</strong>的问题了。</p>
<h2 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 34px; border-bottom: 1px solid #dbdbdb; color: #333;">2 锁定读、update、delete语句</h2>
<ul style="line-height: 160%; box-sizing: content-box; display: block; list-style-type: disc; padding-left: 30px; margin: 6px 0 10px; color: #333;">
<li style="line-height: 160%; box-sizing: content-box; position: relative;">语句一：SELECT ... ... LOCK IN SHARE MODE；</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">语句二：SELECT ... ... FOR UPDATE；</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">语句三：UPDATE ... ... ；</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">语句四：DELETE ... ... ；</li>
</ul>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">语句一和语句二是MySQL中规定的两种<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">锁定读</strong>的语句格式，而语句三和语句四由于在执行过程需要首先定位到被改动的记录并给记录加锁，也可以被认为是一种<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">锁定读</strong>。</p>
<h3 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 27px; color: #333;">2-1 Read Uncommitted/Read Committed隔离级别</h3>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">在READ UNCOMMITTED下语句的加锁方式和READ COMMITTED隔离级别下语句的加锁方式基本一致，所以就放到一块儿说了。值得注意的是，采用加锁方式解决并发事务带来的问题时，其实<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">脏读和不可重复读</strong>在任何一个隔离级别下都不会发生（因为读-写操作需要排队进行）。</p>
<h4 style="line-height: 160%; box-sizing: content-box; font-size: 20px; color: #333;">2-1-1 对主键进行等值查询</h4>
<h5 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 16px; color: #333;">使用SELECT . . . LOCK IN SHARE MODE为记录加锁</h5>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">例：<br/>
SELECT * FROM hero WHERE numer = 8 LOCK IN SHARE MODE；</p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">这个语句执行时只需要访问一下聚簇索引中number值为8的记录，所以只需要给聚簇索引中numer值为8的记录加一个<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">S型Record Locks</strong>。</p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;"><img src="25-加锁分析_files/1 [1].jpg" type="image/jpeg" data-filename="1.jpg"/></p>
<h5 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 16px; color: #333;">使用SELECT . . . FOR UPDATE为记录加锁</h5>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">例：<br/>
SELECT * FROM hero WHERE numer = 8 FOR UPDATE；</p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">这个语句执行时只需要访问一下聚簇索引中number值为8的记录，所以只需要给聚簇索引中numer值为8的记录加一个<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">X型Record Locks</strong>。<img src="25-加锁分析_files/1 [2].jpg" type="image/jpeg" data-filename="1.jpg"/></p>
<h5 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 16px; color: #333;">使用UPDATE为记录加锁</h5>
<ol style="line-height: 160%; box-sizing: content-box; display: block; padding-left: 30px; margin: 6px 0 10px; color: #333; list-style-type: decimal;">
<li style="line-height: 160%; box-sizing: content-box;">
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">没有更新二级索引列</strong><br/>
例：<br/>
UPDATE hero SET country = '汉' WHERE numer = 8；<br/>
加锁方式与上述的<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">for update</strong>语句加锁方式一致，仅仅为聚簇索引中numer值为8的记录加一个<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">X型Record Locks</strong>。</p>
</li>
<li style="line-height: 160%; box-sizing: content-box;">
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">更新二级索引列</strong><br/>
例：<br/>
UPDATE hero SET name = 'cao曹操' WHERE number = 8；<br/>
该语句的实际执行步骤是首先更新对应的number值为8的聚簇索引记录，再更新对应的二级索引记录，所以加锁的步骤就是：</p>
</li>
</ol>
<ul style="line-height: 160%; box-sizing: content-box; display: block; list-style-type: disc; padding-left: 30px; margin: 6px 0 10px; color: #333;">
<li style="line-height: 160%; box-sizing: content-box; position: relative;">为number值为8对应的聚簇索引记录加上<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">X型Record Locks</strong>。</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">为该聚簇索引记录对应的idx_name二级索引记录（也就是name值为'c曹操'，number值为8的那条二级索引记录）加上<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">X型Record Locks</strong>。<br/>
<img src="25-加锁分析_files/1 [3].jpg" type="image/jpeg" data-filename="1.jpg"/></li>
</ul>
<h5 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 16px; color: #333;">使用DELETE为记录加锁</h5>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">例：<br/>
DELETE FROM hero WHERE number = 8；</p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">平时所说的“DELETE表中的一条记录”其实意味着对聚簇索引和所有的二级索引中对应的记录做DELETE操作，本例子中就是要先把number值为8的聚簇索引记录执行DELETE操作，然后把对应的idx_name二级索引记录删除，所以加锁的步骤和上边更新带有二级索引列的UPDATE语句一致。</p>
<h4 style="line-height: 160%; box-sizing: content-box; font-size: 20px; color: #333;">2-1-2 对主键进行范围查询</h4>
<h5 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 16px; color: #333;">使用SELECT . . . LOCK IN SHARE MODE为记录加锁</h5>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">例：<br/>
SELECT * FROM hero WHERE number &lt;= 8 LOCK IN SHARE MODE；</p>
<ol style="line-height: 160%; box-sizing: content-box; display: block; padding-left: 30px; margin: 6px 0 10px; color: #333; list-style-type: decimal;">
<li style="line-height: 160%; box-sizing: content-box;">
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">先到聚簇索引中定位到满足number &lt;= 8的第一条记录，也就是number值为1的记录，然后为其加锁。</p>
</li>
<li style="line-height: 160%; box-sizing: content-box;">
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">判断一下该记录是否符合<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">索引条件下推</strong>中的条件。<br/>
前边介绍过一个称之为<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">索引条件下推（ Index Condition Pushdown，简称ICP）<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">的功能，也就是</strong>把查询中与被使用索引有关的查询条件下推到存储引擎中判断，而不是返回到server层再判断</strong>。不过需要注意的是，索引条件下推只是为了减少回表次数，也就是减少读取完整的聚簇索引记录的次数，从而减少IO操作。而对于聚簇索引而言不需要回表，它本身就包含着全部的列，也起不到减少IO操作的作用，所以InnoDB规定这个<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">索引条件下推特性只适用于二级索引</strong>。也就是说在本例中与被使用索引有关的条件是：number &lt;= 8，而number列又是聚簇索引列，所以本例中并没有符合索引条件下推的查询条件，自然也就不需要判断该记录是否符合索引条件下推中的条件。</p>
</li>
<li style="line-height: 160%; box-sizing: content-box;">
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">判断一下该记录是否符合范围查询的边界条件<br/>
因为在本例中是利用主键number进行范围查询，InnoDB规定每从聚簇索引中取出一条记录时都要判断一下该记录是否符合范围查询的边界条件，也就是number &lt;= 8这个条件。如果符合的话将其返回给<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">server层</strong>继续处理，否则的话需要释放掉在该记录上加的锁，并给server层返回一个查询完毕的信息。<br/>
对于number值为1的记录是符合这个条件的，所以会将其返回到server层继续处理。</p>
</li>
<li style="line-height: 160%; box-sizing: content-box;">
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">将该记录返回到server层继续判断。<br/>
server层如果收到存储引擎层提供的查询完毕的信息，就结束查询，否则继续判断那些没有进行索引条件下推的条件，在本例中就是继续判断number &lt;= 8这个条件是否成立。噫，不是在第3步中已经判断过了么，怎么在这又判断一回？是的，设计InnoDB的大叔采用的策略就是这么简单粗暴，把凡是没有经过索引条件下推的条件都需要放到server层再判断一遍。如果该记录符合剩余的条件（没有进行索引条件下推的条件），那么就把它发送给客户端，不然的话需要释放掉在该记录上加的锁。</p>
</li>
<li style="line-height: 160%; box-sizing: content-box;">
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">然后刚刚查询得到的这条记录（也就是number值为1的记录）组成的单向链表继续向后查找，得到了number值为3的记录，然后重复第2，3，4、5这几个步骤。<img src="25-加锁分析_files/Image [3].png" type="image/png" data-filename="Image.png"/></p>
</li>
</ol>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">但是这个过程有个问题，就是当找到number值为8的那条记录的时候，还得向后找一条记录（也就是number值为15的记录），在存储引擎读取这条记录的时候，也就是上述的第1步中，就得为这条记录加锁，然后在第3步时，判断该记录不符合number &lt;= 8这个条件，又要释放掉这条记录的锁，这个过程导致number值为15的记录先被加锁，然后把锁释放掉，过程就是这样：<img src="25-加锁分析_files/1 [4].jpg" type="image/jpeg" data-filename="1.jpg"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">这个过程有意思的一点就是，如果你先在事务T1中执行：<img src="25-加锁分析_files/Image [4].png" type="image/png" data-filename="Image.png"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">然后再到事务T2中执行：<img src="25-加锁分析_files/Image [5].png" type="image/png" data-filename="Image.png"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">是没有问题的，因为在T2执行时，事务T1已经释放掉了number值为15的记录的锁，<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">但是如果你先执行T2，再执行T1，由于T2已经持有了number值为15的记录的锁，事务T1将因为获取不到这个锁而等待。</strong></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">我们再看一个使用主键进行范围查询的例子：<img src="25-加锁分析_files/Image [6].png" type="image/png" data-filename="Image.png"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">这个语句的执行过程其实和我们举的上一个例子类似。也是先到聚簇索引中定位到满足number &gt;= 8这个条件的第一条记录，也就是number值为8的记录，然后就可以沿着由记录组成的单向链表一路向后找，每找到一条记录，就会为其加上锁，然后判断该记录符不符合范围查询的边界条件，不过这里的边界条件比较特殊：number &gt;= 8，只要记录不小于8就算符合边界条件，所以判断和没判断是一样一样的。最后把这条记录返回给server层，server层再判断number &gt;= 8这个条件是否成立，如果成立的话就发送给客户端，否则的话就结束查询。不过InnoDB存储引擎找到索引中的最后一条记录，也就是Supremum伪记录之后，在存储引擎内部就可以立即判断这是一条伪记录，不必要返回给server层处理，也没必要给它也加上锁（也就是说在第1步中就压根儿没给这条记录加锁）。整个过程会给number值为8、15、20这三条记录加上S型Record Locks，画个图表示一下就是这样：<img src="25-加锁分析_files/1 [5].jpg" type="image/jpeg" data-filename="1.jpg"/></p>
<h5 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 16px; color: #333;">使用SELECT . . . FOR UPDATE为记录加锁</h5>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">和SELECT ... FOR UPDATE语句类似，只不过加的是<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">X型Record Locks</strong>。</p>
<h5 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 16px; color: #333;">使用UPDATE来为记录加锁</h5>
<ol style="line-height: 160%; box-sizing: content-box; display: block; padding-left: 30px; margin: 6px 0 10px; color: #333; list-style-type: decimal;">
<li style="line-height: 160%; box-sizing: content-box;">
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">没有更新二级索引</strong><br/>
例：<br/>
UPDATE hero SET country = '汉' WHERE number &gt;= 8；<br/>
这条UPDATE语句并没有更新二级索引列，加锁方式和上边所说的SELECT ... FOR UPDATE语句一致。</p>
</li>
<li style="line-height: 160%; box-sizing: content-box;">
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">更新二级索引</strong><br/>
例：<br/>
UPDATE hero SET name = 'cao曹操' WHERE number &gt;= 8；<br/>
这时候会首先更新聚簇索引记录，再更新对应的二级索引记录，所以加锁的步骤就是：<img src="25-加锁分析_files/Image [7].png" type="image/png" data-filename="Image.png"/><img src="25-加锁分析_files/1 [6].jpg" type="image/jpeg" data-filename="1.jpg"/></p>
</li>
</ol>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">如果是下边这个语句：UPDATE hero SET namey = '汉' WHERE number &lt;= 8；<br/>
则会对number值为1、3、8聚簇索引记录以及它们对应的二级索引记录加X型正经记录锁，加锁顺序和上边语句中的加锁顺序类似，都是先对一条聚簇索引记录加锁后，再给对应的二级索引记录加锁。之后会继续对number值为15的聚簇索引记录加锁，但是随后InnoDB存储引擎判断它不符合边界条件，随即会释放掉该聚簇索引记录上的锁（注意这个过程中没有对number值为15的聚簇索引记录对应的二级索引记录加锁）。</p>
<h5 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 16px; color: #333;">使用UPDATE来为记录加锁</h5>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">例：<br/>
DELETE FROM hero WHERE number &gt;= 8；<br/>
和<br/>
DELETE FROM hero WHERE number &lt;= 8；</p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">这两个语句的加锁情况和更新带有二级索引列的UPDATE语句一致，但需要注意的是，delete操作要多所有的二级索引中相应的记录加锁。</p>
<h4 style="line-height: 160%; box-sizing: content-box; font-size: 20px; color: #333;">2-1-3 使用二级索引进行等值查找</h4>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">在READ UNCOMMITTED和READ COMMITTED隔离级别下，使用普通的二级索引和唯一二级索引进行加锁的过程是一样的，所以也就不分开讨论了。</p>
<h5 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 16px; color: #333;">使用SELECT ... LOCK IN SHARE MODE来为记录加锁</h5>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">例：<br/>
SELECT * FROM hero WHERE name = 'c曹操' LOCK IN SHARE MODE；</p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">这个语句的执行过程是先通过二级索引idx_name定位到满足name = 'c曹操'条件的二级索引记录，然后进行回表操作。所以先要对<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">二级索引记录加S型Record Locks</strong>，然后再给<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">对应的聚簇索引记录加S型Record Locks</strong>，示意图如下：<br/>
<img src="25-加锁分析_files/1 [7].jpg" type="image/jpeg" data-filename="1.jpg"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">这里需要再次强调一下这个语句的加锁顺序：</p>
<ul style="line-height: 160%; box-sizing: content-box; display: block; list-style-type: disc; padding-left: 30px; margin: 6px 0 10px; color: #333;">
<li style="line-height: 160%; box-sizing: content-box; position: relative;">先对name列为'c曹操'二级索引记录进行加锁。</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">再对相应的聚簇索引记录进行加锁。</li>
</ul>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;"><img src="25-加锁分析_files/Image [8].png" type="image/png" data-filename="Image.png"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">现在要介绍一个非常有趣的事情，我们假设上边这个语句在事务T1中运行，然后事务T2中运行下边一个我们之前介绍过的语句：<br/>
UPDATE hero SET name = '曹操' WHERE number = 8；</p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">这两个语句都是要对number值为8的聚簇索引记录和对应的二级索引记录加锁，但是不同点是加锁的顺序不一样。这个UPDATE语句是先对聚簇索引记录进行加锁，后对二级索引记录进行加锁，如果在不同事务中运行上述两个语句，可能发生一种贼奇妙的事情 ——</p>
<ul style="line-height: 160%; box-sizing: content-box; display: block; list-style-type: disc; padding-left: 30px; margin: 6px 0 10px; color: #333;">
<li style="line-height: 160%; box-sizing: content-box; position: relative;">事务T2持有了聚簇索引记录的锁，事务T1持有了二级索引记录的锁。</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">事务T2在等待获取二级索引记录上的锁，事务T1在等待获取聚簇索引记录上的锁。</li>
</ul>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">两个事务都分别持有一个锁，而且都在等待对方已经持有的那个锁，这种情况就是所谓的死锁，两个事务都无法运行下去，必须选择一个进行回滚，对性能影响比较大。</p>
<h5 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 16px; color: #333;">使用SELECT ... FOR UPDATE来为记录加锁</h5>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">例：<br/>
SELECT * FROM hero WHERE name = 'c曹操' FOR UPDATE；</p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">这种情况下与SELECT ... LOCK IN SHARE MODE语句的加锁情况类似，都是给访问到的二级索引记录和对应的聚簇索引记录加锁，只不过加的是<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">X型Record Locks</strong>罢了。</p>
<h5 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 16px; color: #333;">使用UPDATE来为记录加锁</h5>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">与等值查询二级索引记录的SELECT ... FOR UPDATE的加锁情况类似，不过如果被更新的列中还有别的二级索引列的话，对应的二级索引记录也会被加锁。</p>
<h5 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 16px; color: #333;">使用DELETE来为记录加锁</h5>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">与SELECT ... FOR UPDATE的加锁情况类似，不过如果表中还有别的二级索引列的话，对应的二级索引记录也会被加锁。</p>
<h4 style="line-height: 160%; box-sizing: content-box; font-size: 20px; color: #333;">2-1-4 使用二级索引进行范围查找</h4>
<h5 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 16px; color: #333;">使用SELECT ... LOCK IN SHARE MODE来为记录加锁</h5>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">例：SELECT * FROM hero FORCE INDEX(idx_name) WHERE name &gt;= 'c曹操' LOCK IN SHARE MODE；<br/>
<img src="25-加锁分析_files/Image [9].png" type="image/png" data-filename="Image.png"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;"><img src="25-加锁分析_files/Image [10].png" type="image/png" data-filename="Image.png"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">这个语句的执行过程其实是先到二级索引中定位到满足name &gt;= 'c曹操'的第一条记录，也就是name值为c曹操的记录，然后就可以沿着这条记录的链表一路向后找，从二级索引idx_name的示意图中可以看出，所有的用户记录都满足name &gt;= 'c曹操'的这个条件，所以所有的二级索引记录都会被加<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">S型Record Locks</strong>，它们对应的聚簇索引记录也会被加<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">S型Record Locks</strong>。不过需要注意一下加锁顺序，<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">对一条二级索引记录加锁完后，会接着对它相应的聚簇索引记录加锁</strong>，完后才会对下一条二级索引记录进行加锁，以此类推～ 画个图表示一下就是这样：<br/>
<img src="25-加锁分析_files/1 [8].jpg" type="image/jpeg" data-filename="1.jpg"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">再来看下边这个语句：<br/>
SELECT * FROM hero FORCE INDEX(idx_name) WHERE name &lt;= 'c曹操' LOCK IN SHARE MODE；</p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">这个语句的加锁情况就有点儿有趣了。前边说在使用number &lt;= 8这个条件的语句中，需要把number值为15的记录也加一个锁，之后又判断它不符合边界条件而把锁释放掉。而对于查询条件name &lt;= 'c曹操'的语句来说，执行该语句需要使用到二级索引，而与二级索引相关的条件是可以使用<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">索引条件下推</strong>这个特性的。InnoDB规定，<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">如果一条记录不符合索引条件下推中的条件的话，直接跳到下一条记录（这个过程根本不将其返回到server层），如果这已经是最后一条记录，那么直接向server层报告查询完毕</strong>。但是这里头有个问题：先对一条记录加了锁，然后再判断该记录是不是符合索引条件下推的条件，如果不符合直接跳到下一条记录或者直接向server层报告查询完毕，这个过程中并没有把那条被加锁的记录上的锁释放掉！！！。本例中使用的查询条件是name &lt;= 'c曹操'，在为name值为'c曹操'的二级索引记录以及它对应的聚簇索引加锁之后，会接着二级索引中的下一条记录，也就是name值为'l刘备'的那条二级索引记录，由于该记录不符合索引条件下推的条件，而且是范围查询的最后一条记录，会直接向server层报告查询完毕，重点是这个过程中并不会释放name值为'l刘备'的二级索引记录上的锁，也就导致了语句执行完毕时的加锁情况如下所示：<br/>
<img src="25-加锁分析_files/1 [9].jpg" type="image/jpeg" data-filename="1.jpg"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">这样子会造成一个尴尬情况，假如T1执行了上述语句并且尚未提交，T2再执行这个语句：<br/>
SELECT * FROM hero WHERE name = 'l刘备' FOR UPDATE；</p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">T2中的语句需要获取name值为l刘备的二级索引记录上的X型Record Locks，而T1中仍然持有name值为l刘备的二级索引记录上的S型Record Locks，这就造成了T2获取不到锁而进入等待状态。<br/>
<img src="25-加锁分析_files/Image [11].png" type="image/png" data-filename="Image.png"/></p>
<h5 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 16px; color: #333;">使用SELECT ... FOR UPDATE来为记录加锁</h5>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">和SELECT ... FOR UPDATE语句类似，只不过加的是<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">X型Record Locks</strong>。</p>
<h5 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 16px; color: #333;">使用UPDATE来为记录加锁</h5>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">例：<br/>
UPDATE hero SET country = '汉' WHERE name &gt;= 'c曹操'；</p>
<ul style="line-height: 160%; box-sizing: content-box; display: block; list-style-type: disc; padding-left: 30px; margin: 6px 0 10px; color: #333;">
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">没有索引列被更新</strong><br/>
它的加锁方式和上边所说的SELECT ... FOR UPDATE语句一致。</p>
</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">更新二级索引</strong><br/>
那么也会为对应的二级索引记录进行加锁；</p>
</li>
</ul>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">不过还有一个有趣的情况，比方说：<br/>
UPDATE hero SET country = '汉' WHERE name &lt;= 'c曹操'；</p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">前边说的<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">索引条件下推</strong>这个特性<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">只适用于SELECT语句</strong>，也就是说UPDATE语句中无法使用，那么这个语句就会为name值为'c曹操'和'l刘备'的二级索引记录以及它们对应的聚簇索引进行加锁，之后在判断边界条件时发现name值为'l刘备'的二级索引记录不符合name &lt;= 'c曹操'条件，再把该二级索引记录和对应的聚簇索引记录上的锁释放掉。这个过程如下图所示：<img src="25-加锁分析_files/1 [10].jpg" type="image/jpeg" data-filename="1.jpg"/></p>
<h5 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 16px; color: #333;">使用DELETE来为记录加锁</h5>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;"><img src="25-加锁分析_files/Image [12].png" type="image/png" data-filename="Image.png"/></p>
<h4 style="line-height: 160%; box-sizing: content-box; font-size: 20px; color: #333;">2-1-5 使用全表扫描</h4>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">比方说：<br/>
SELECT * FROM hero WHERE country = '魏' LOCK IN SHARE MODE；</p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">由于country列上未建索引，所以只能采用全表扫描的方式来执行这条查询语句，存储引擎每读取一条聚簇索引记录，就会为这条记录加锁一个<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">S型Record Locks</strong>，然后返回给server层，如果server层判断country = '魏'这个条件是否成立，如果成立则将其发送给客户端，否则会释放掉该记录上的锁，画个图就像这样：<img src="25-加锁分析_files/1 [11].jpg" type="image/jpeg" data-filename="1.jpg"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">使用SELECT ... FOR UPDATE进行加锁的情况与上边类似，只不过加的是<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">X型Record Locks</strong>。</p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">对于UPDATE和DELETE的语句来说，在遍历聚簇索引中的记录，都会为该聚簇索引记录加上<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">X型Record Locks</strong>，然后：</p>
<ul style="line-height: 160%; box-sizing: content-box; display: block; list-style-type: disc; padding-left: 30px; margin: 6px 0 10px; color: #333;">
<li style="line-height: 160%; box-sizing: content-box; position: relative;">如果该聚簇索引记录不满足条件，直接把该记录上的锁释放掉；</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">如果该聚簇索引记录满足条件，则会对相应的二级索引记录加上<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">X型Record Locks</strong>（DELETE语句会对所有二级索引列加锁，UPDATE语句只会为更新的二级索引列对应的二级索引记录加锁）。</li>
</ul>
<h3 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 27px; color: #333;">2-2 Repeatable Read隔离级别</h3>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">采用加锁的方式解决并发事务产生的问题时，REPEATABLE READ隔离级别与READ UNCOMMITTED和READ COMMITTED这两个隔离级别相比，最主要的就是要解决幻读问题，幻读问题的解决还得靠我们之前讲过的<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">gap锁</strong>。</p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">但是需要注意的是<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">Gap锁只对INSERT语句生效。</strong></p>
<h3 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 27px; color: #333;">2-2-1 使用主键进行等值查询</h3>
<h4 style="line-height: 160%; box-sizing: content-box; font-size: 20px; color: #333;">使用SELECT . . . LOCK IN SHARE MODE来为记录加锁</h4>
<ul style="line-height: 160%; box-sizing: content-box; display: block; list-style-type: disc; padding-left: 30px; margin: 6px 0 10px; color: #333;">
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">查询主键值存在相应的记录</strong><br/>
例：<br/>
SELECT * FROM hero WHERE number = 8 LOCK IN SHARE MODE；<br/>
这种情况下和READ UNCOMMITTED／READ COMMITTED隔离级别下一样，只需要为这条number值为8的记录加一个<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">S型Record Locks</strong>就好了，如图所示：<br/>
<img src="25-加锁分析_files/1 [12].jpg" type="image/jpeg" data-filename="1.jpg"/></p>
</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">查询主键值不存在相应的记录</strong><br/>
例：<br/>
SELECT * FROM hero WHERE number = 7 LOCK IN SHARE MODE；<br/>
由于number值为7的记录不存在，为了禁止幻读现象（也就是避免在同一事务中下一次执行相同语句时得到的结果集中包含number值为7的记录），在当前事务提交前我们需要预防别的事务插入number值为7的新记录，所以需要在number值为8的记录上加一个gap锁，也就是不允许别的事务插入number值在(3, 8)这个区间的新记录。画个图表示一下：<img src="25-加锁分析_files/1 [13].jpg" type="image/jpeg" data-filename="1.jpg"/></p>
</li>
</ul>
<h4 style="line-height: 160%; box-sizing: content-box; font-size: 20px; color: #333;">使用SELECT . . . FOR UPDATE来为记录加锁</h4>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">与SELECT . . . LOCK IN SHARE MODE类似，只不过加的是<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">X型Record Locks</strong></p>
<h4 style="line-height: 160%; box-sizing: content-box; font-size: 20px; color: #333;">使用UPDATE来为记录加锁</h4>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">与SELECT . . . FOR UPDATE类似，只不过加的是<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">X型Record Locks</strong>，对于更新二级索引的情况，和READ UNCOMMITTED／READ COMMITTED隔离级别下的情况类似。</p>
<h4 style="line-height: 160%; box-sizing: content-box; font-size: 20px; color: #333;">使用DELETE来为记录加锁</h4>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">与SELECT . . . FOR UPDATE类似，只不过加的是<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">X型Record Locks</strong>，对于更新二级索引的情况，和READ UNCOMMITTED／READ COMMITTED隔离级别下的情况类似。</p>
<h3 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 27px; color: #333;">2-2-2 使用主键进行范围查询</h3>
<h4 style="line-height: 160%; box-sizing: content-box; font-size: 20px; color: #333;">使用SELECT ... LOCK IN SHARE MODE来为记录加锁</h4>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">例：<br/>
SELECT * FROM hero WHERE number &gt;= 8 LOCK IN SHARE MODE；</p>
<ul style="line-height: 160%; box-sizing: content-box; display: block; list-style-type: disc; padding-left: 30px; margin: 6px 0 10px; color: #333;">
<li style="line-height: 160%; box-sizing: content-box; position: relative;">为number值为8的聚簇索引记录加一个<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">S型Record Locks</strong>。</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">为number值大于8的所有聚簇索引记录都加一个<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">S型next-key锁</strong>（包括Supremum伪记录）。<br/>
<img src="25-加锁分析_files/1 [14].jpg" type="image/jpeg" data-filename="1.jpg"/></li>
</ul>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">与READ UNCOMMITTED/READ COMMITTED隔离级别类似，在REPEATABLE READ隔离级别下，下边这个范围查询也是有点特殊：<br/>
SELECT * FROM hero WHERE number &lt;= 8 LOCK IN SHARE MODE；</p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">在READ UNCOMMITTED/READ COMMITTED隔离级别下，这个语句会为number值为1、3、8、15这4条记录都加上S型正经记录锁，然后由于number值为15的记录不满足边界条件number &lt;= 8，随后便把这条记录的锁释放掉。</p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">在REPEATABLE READ隔离级别下的加锁过程与之类似，不过会为1、3、8、15这4条记录都加上<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">S型next-key锁</strong>，<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">但是有一点需要大家十分注意：REPEATABLE READ隔离级别下，在判断number值为15的记录不满足边界条件 number &lt;= 8 后，并不会去释放加在该记录上的锁！！！ 所以在REPEATABLE READ隔离级别下，该语句的加锁示意图就如下所示：</strong><br/>
<img src="25-加锁分析_files/1 [15].jpg" type="image/jpeg" data-filename="1.jpg"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">这样如果别的事务想要插入的新记录的number值在(-∞, 1)、(1, 3)、(3, 8)、(8, 15)之间的话，是会进入等待状态的。<img src="25-加锁分析_files/Image [13].png" type="image/png" data-filename="Image.png"/></p>
<h4 style="line-height: 160%; box-sizing: content-box; font-size: 20px; color: #333;">使用SELECT . . . FOR UPDATE来为记录加锁</h4>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">和SELECT ... LOCK IN SHARE MODE语句类似，只不过需要将上边提到的S型next-key锁替换成<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">X型next-key锁</strong>。</p>
<h4 style="line-height: 160%; box-sizing: content-box; font-size: 20px; color: #333;">使用UPDATE来为记录加锁</h4>
<ul style="line-height: 160%; box-sizing: content-box; display: block; list-style-type: disc; padding-left: 30px; margin: 6px 0 10px; color: #333;">
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">未更新二级索引列</strong><br/>
加锁方式和上边所说的SELECT ... FOR UPDATE语句一致。</p>
</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">更新了二级索引列</strong><br/>
例：UPDATE hero SET name = 'cao曹操' WHERE number &gt;= 8；<br/>
对聚簇索引记录加锁的情况和SELECT ... FOR UPDATE语句一致，也就是对number值为8的聚簇索引记录加X型正经记录锁，对number值15、20的聚簇索引记录以及Supremum记录加X型next-key锁。但是因为也要更新二级索引idx_name，所以也会对number值为8、15、20的聚簇索引记录对应的idx_name二级索引记录加X型正经记录锁，画个图表示一下：<br/>
<img src="25-加锁分析_files/1 [16].jpg" type="image/jpeg" data-filename="1.jpg"/></p>
</li>
</ul>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">如果是下边这个语句：UPDATE hero SET name = 'cao曹操' WHERE number &lt;= 8；<br/>
则会对number值为1、3、8、15的聚簇索引记录加X型next-key，其中number值为15的聚簇索引记录不满足number &lt;= 8的边界条件，虽然在REPEATABLE READ隔离级别下不会将它的锁释放掉，但是也并不会对这条聚簇索引记录对应的二级索引记录加锁，也就是说只会为number值为1、3、8的聚簇索引记录对应的idx_name二级索引记录加X型正经记录锁，加锁示意图如下所示：<img src="25-加锁分析_files/1 [17].jpg" type="image/jpeg" data-filename="1.jpg"/></p>
<h4 style="line-height: 160%; box-sizing: content-box; font-size: 20px; color: #333;">使用DELETE来为记录加锁</h4>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">这两个语句的加锁情况和更新带有二级索引列的UPDATE语句一致，就不画图了。</p>
<h3 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 27px; color: #333;">2-2-3 使用唯一二级索引进行等值查询</h3>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">由于hero表并没有唯一二级索引，我们把原先的idx_name修改为一个唯一二级索引uk_name：</p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">ALTER TABLE hero DROP INDEX idx_name, ADD UNIQUE KEY uk_name (name);</p>
<h4 style="line-height: 160%; box-sizing: content-box; font-size: 20px; color: #333;">使用SELECT ... LOCK IN SHARE MODE语句来为记录加锁</h4>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">例：<br/>
SELECT * FROM hero WHERE name = 'c曹操' LOCK IN SHARE MODE；</p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">由于唯一二级索引具有唯一性，如果在一个事务中第一次执行上述语句时将得到一条记录，第二次执行上述语句前肯定不会有别的事务插入多条name值为'c曹操'的记录（二级索引具有唯一性），也就是说一个事务中两次执行上述语句并不会发生幻读，这种情况下和READ UNCOMMITTED／READ COMMITTED隔离级别下一样，我们只需要为这条name值为'c曹操'的二级索引记录加一个<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">S型Record Locks</strong>，然后再为它对应的聚簇索引记录加一个S型正经记录锁就好了，我们画个图看看：<br/>
<img src="25-加锁分析_files/1 [18].jpg" type="image/jpeg" data-filename="1.jpg"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">如果对唯一二级索引列进行等值查询的记录并不存在，比如：<br/>
SELECT * FROM hero WHERE name = 'g关羽' LOCK IN SHARE MODE；</p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">为了禁止幻读，所以需要保证别的事务不能再插入name值为'g关羽'的新记录。在唯一二级索引uk_name中，键值比'g关羽'大的第一条记录的键值为l刘备，所以需要在这条二级索引记录上加一个<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">gap锁</strong>，如图所示：<img src="25-加锁分析_files/1 [19].jpg" type="image/jpeg" data-filename="1.jpg"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">注意，<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">这里只对二级索引记录进行加锁，并不会对聚簇索引记录进行加锁。</strong></p>
<h4 style="line-height: 160%; box-sizing: content-box; font-size: 20px; color: #333;">使用SELECT ... FOR UPDATE语句来为记录加锁</h4>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">和SELECT ... LOCK IN SHARE MODE语句类似，只不过加的是<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">X型Record Locks</strong>。</p>
<h4 style="line-height: 160%; box-sizing: content-box; font-size: 20px; color: #333;">使用UPDATE语句来为记录加锁</h4>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">与SELECT ... FOR UPDATE的加锁情况类似，不过如果被更新的列中还有别的二级索引列的话，这些对应的二级索引记录也会被加<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">X型Record Locks</strong>。</p>
<h4 style="line-height: 160%; box-sizing: content-box; font-size: 20px; color: #333;">使用DELETE语句来为记录加锁</h4>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">与SELECT ... FOR UPDATE的加锁情况类似，不过如果被更新的列中还有别的二级索引列的话，这些对应的二级索引记录也会被加<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">X型Record Locks</strong>。</p>
<h3 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 27px; color: #333;">2-2-4 使用唯一二级索引进行范围查询</h3>
<h4 style="line-height: 160%; box-sizing: content-box; font-size: 20px; color: #333;">使用SELECT ... LOCK IN SHARE MODE语句来为记录加锁</h4>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">例：<br/>
SELECT * FROM hero FORCE INDEX(uk_name) WHERE name &gt;= 'c曹操' LOCK IN SHARE MODE；</p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">这个语句的执行过程其实是先到二级索引中定位到满足name &gt;= 'c曹操'的第一条记录，也就是name值为c曹操的记录，然后就可以沿着由记录组成的单向链表一路向后找。从二级索引idx_name的示意图中可以看出，所有的用户记录都满足name &gt;= 'c曹操'的这个条件，所以所有的二级索引记录都会被加<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">S型next-key锁</strong>，它们对应的聚簇索引记录也会被加<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">S型Record Locks</strong>，二级索引的最后一条Supremum记录也会被加<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">S型next-key锁</strong>。不过需要注意一下加锁顺序，对一条二级索引记录加锁完后，会接着对它响应的聚簇索引记录加锁，完后才会对下一条二级索引记录进行加锁，以此类推～ 画个图表示一下就是这样：<img src="25-加锁分析_files/1 [20].jpg" type="image/jpeg" data-filename="1.jpg"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">例：<br/>
SELECT * FROM hero WHERE name &lt;= 'c曹操' LOCK IN SHARE MODE；</p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">这个语句先会为name值为'c曹操'的二级索引记录加S型next-key锁以及它对应的聚簇索引记录加S型正经记录锁。然后还要给name值为'l刘备'的二级索引记录加S型next-key锁，name值为'l刘备'的二级索引记录不满足索引条件下推的name &lt;= 'c曹操'条件，压根儿不会释放掉该记录的锁就直接报告server层查询完毕了。这样可以禁止其他事务插入name值在('c曹操', 'l刘备')之间的新记录，从而防止幻读产生。所以这个过程的加锁示意图如下：<br/>
<img src="25-加锁分析_files/1 [21].jpg" type="image/jpeg" data-filename="1.jpg"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">这里大家要注意一下，<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">InnoDB在这里给name值为'l刘备'的二级索引记录加的是S型next-key锁，而不是简单的gap锁</strong>。</p>
<h4 style="line-height: 160%; box-sizing: content-box; font-size: 20px; color: #333;">使用SELECT ... FOR UPDATE语句来为记录加锁</h4>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">和SELECT ... LOCK IN SHARE MODE语句类似，只不过加的是<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">X型锁</strong>。</p>
<h4 style="line-height: 160%; box-sizing: content-box; font-size: 20px; color: #333;">使用UPDATE语句来为记录加锁</h4>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">例：<br/>
UPDATE hero SET country = '汉' WHERE name &gt;= 'c曹操'；<br/>
假设该语句执行时使用了uk_name二级索引来进行锁定读（如果二级索引扫描的记录太多，也可能因为成本过大直接使用全表扫描的方式进行锁定读），而这条UPDATE语句并没有更新二级索引列，那么它的加锁方式和上边所说的SELECT ... FOR UPDATE语句一致。如果有其他二级索引列也被更新，那么也会为这些二级索引记录进行加锁，就不赘述了。</p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">不过还需要强调一种情况，比方说：<br/>
UPDATE hero SET country = '汉' WHERE name &lt;= 'c曹操'；</p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">我们前边说的索引条件下推这个特性只适用于SELECT语句，也就是说UPDATE语句中无法使用，无法使用索引条件下推这个特性时需要先进行回表操作，那么这个语句就会为name值为'c曹操'和'l刘备'的二级索引记录加X型next-key锁，对它们对应的聚簇索引记录进行加X型正经记录锁。不过之后在判断边界条件时，虽然name值为'l刘备'的二级索引记录不符合name &lt;= 'c曹操'的边界条件，<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">但是在REPEATABLE READ隔离级别下并不会释放该记录上加的锁</strong>，整个过程的加锁示意图就是：<br/>
<img src="25-加锁分析_files/1 [22].jpg" type="image/jpeg" data-filename="1.jpg"/></p>
<h4 style="line-height: 160%; box-sizing: content-box; font-size: 20px; color: #333;">使用DELETE语句来为记录加锁<img src="25-加锁分析_files/Image [14].png" type="image/png" data-filename="Image.png"/></h4>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">如果这两个语句采用二级索引来进行锁定读，那么它们的加锁情况和更新带有二级索引列的UPDATE语句一致，就不画图了。</p>
<h3 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 27px; color: #333;">2-2-5 对普通二级索引进行等值查询</h3>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">我们再把上边的唯一二级索引uk_name改回普通二级索引idx_name：<br/>
ALTER TABLE hero DROP INDEX uk_name, ADD INDEX idx_name (name)；</p>
<h4 style="line-height: 160%; box-sizing: content-box; font-size: 20px; color: #333;">使用SELECT ... LOCK IN SHARE MODE语句来为记录加锁</h4>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">例：<br/>
SELECT * FROM hero WHERE name = 'c曹操' LOCK IN SHARE MODE；</p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">由于普通的二级索引没有唯一性，所以一个事务在执行上述语句之后，要阻止别的事务插入name值为'c曹操'的新记录，InnoDB采用下边的方式对上述语句进行加锁：</p>
<ul style="line-height: 160%; box-sizing: content-box; display: block; list-style-type: disc; padding-left: 30px; margin: 6px 0 10px; color: #333;">
<li style="line-height: 160%; box-sizing: content-box; position: relative;">对所有name值为'c曹操'的二级索引记录加<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">S型next-key锁</strong>，它们对应的聚簇索引记录加<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">S型Record Locks</strong>。</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">对最后一个name值为'c曹操'的二级索引记录的<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">下一条二级索引记录加gap锁</strong>；<br/>
<img src="25-加锁分析_files/1 [23].jpg" type="image/jpeg" data-filename="1.jpg"/></li>
</ul>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">如果对普通二级索引等值查询的值并不存在，比如：<br/>
SELECT * FROM hero WHERE name = 'g关羽' LOCK IN SHARE MODE；</p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">加锁方式和我们上边唠叨过的唯一二级索引的情况是一样的，就不赘述了。（<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">Gap锁</strong>）</p>
<h4 style="line-height: 160%; box-sizing: content-box; font-size: 20px; color: #333;">使用SELECT ... FOR UPDATE语句来为记录加锁</h4>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">和SELECT ... LOCK IN SHARE MODE语句类似，只不过加的是X型正经记录锁</p>
<h4 style="line-height: 160%; box-sizing: content-box; font-size: 20px; color: #333;">使用UPDATE语句来为记录加锁</h4>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">与SELECT ... FOR UPDATE的加锁情况类似，不过如果被更新的列中还有别的二级索引列的话，这些对应的二级索引记录也会被加锁。</p>
<h4 style="line-height: 160%; box-sizing: content-box; font-size: 20px; color: #333;">使用DELETE语句来为记录加锁</h4>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">与SELECT ... FOR UPDATE的加锁情况类似，不过如果表中还有别的二级索引列的话，这些对应的二级索引记录也会被加锁。</p>
<h3 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 27px; color: #333;">2-2-6 对普通二级索引进行范围查询</h3>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">与唯一二级索引的加锁情况类似</p>
<h3 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 27px; color: #333;">2-2-7 全表扫描的情况</h3>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">例：<br/>
SELECT * FROM hero WHERE country = '魏' LOCK IN SHARE MODE；</p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">由于country列上未建索引，所以只能采用全表扫描的方式来执行这条查询语句，存储引擎每读取一条聚簇索引记录，就会为这条记录加锁一个S型next-key锁，然后返回给server层，如果server层判断country = '魏'这个条件是否成立，如果成立则将其发送给客户端，否则会向InnoDB存储引擎发送释放掉该记录上的锁的消息，不过<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">在REPEATABLE READ隔离级别下，InnoDB存储引擎并不会真正的释放掉锁，所以聚簇索引的全部记录都会被加锁，并且在事务提交前不释放</strong>。画个图就像这样：<br/>
<img src="25-加锁分析_files/1 [24].jpg" type="image/jpeg" data-filename="1.jpg"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">大家看到了么：<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">全部记录都被加了next-key锁！此时别的事务别说想向表中插入啥新记录了，就是对某条记录加X锁都不可以，这种情况下会极大影响访问该表的并发事务处理能力，所以如果可能的话，尽可能为表建立合适的索引.</strong></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">使用SELECT ... FOR UPDATE进行加锁的情况与上边类似，只不过加的是X型正经记录锁，就不赘述了。</p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">对于UPDATE ...语句来说，加锁情况与SELECT ... FOR UPDATE类似，不过如果被更新的列中还有别的二级索引列的话，这些对应的二级索引记录也会被加X型正经记录锁。</p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">对于DELETE ...的语句来说，加锁情况与SELECT ... FOR UPDATE类似，不过如果表中还有别的二级索引列的话，这些对应的二级索引记录也会被加X型正经记录锁。</p>
<h2 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 34px; border-bottom: 1px solid #dbdbdb; color: #333;">3 INSERT语句</h2>
<h4 style="line-height: 160%; box-sizing: content-box; font-size: 20px; color: #333;">Insert Intention Locks</h4>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">一个事务在插入一条记录时需要判断一下插入位置是不是被别的事务加了所谓的gap锁，如果有的话，插入操作需要等待，直到拥有gap锁的那个事务提交。但是InnoDB规定事务在等待的时候也需要在内存中生成一个<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">锁结构</strong>，表明有事务想在某个<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">间隙</strong>中插入新记录，但是现在在等待，这种类型的锁称为<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">Insert Intention Locks</strong>，官方的类型名称为：<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">LOCK_INSERT_INTENTION</strong>，也可以称为<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">插入意向锁</strong>。</p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">比方说我们把number值为8的那条记录加一个插入意向锁的示意图如下：<br/>
<img src="25-加锁分析_files/Image.jpg" type="image/jpeg" data-filename="Image.jpg"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">为了让大家彻底理解这个插入意向锁的功能，我们还是举个例子然后画个图表示一下。比方说现在T1为number值为8的记录加了一个gap锁，然后T2和T3分别想向hero表中插入number值分别为4、5的两条记录，所以现在为number值为8的记录加的锁的示意图就如下所示：<br/>
<img src="25-加锁分析_files/Image [1].jpg" type="image/jpeg" data-filename="Image.jpg"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">从图中可以看到，由于T1持有gap锁，所以T2和T3需要生成一个插入意向锁的锁结构并且处于等待状态。当T1提交后会把它获取到的锁都释放掉，这样T2和T3就能获取到对应的插入意向锁了（本质上就是把插入意向锁对应锁结构的is_waiting属性改为false），T2和T3之间也并不会相互阻塞，它们可以同时获取到number值为8的插入意向锁，然后执行插入操作。事实上插入意向锁并不会阻止别的事务继续获取该记录上任何类型的锁（插入意向锁就是这么鸡肋）。</p>
<h4 style="line-height: 160%; box-sizing: content-box; font-size: 20px; color: #333;">隐式锁</h4>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">前边说一个事务在执行INSERT操作时，如果即将插入的间隙已经被其他事务加了gap锁，那么本次INSERT操作会阻塞，并且当前事务会在该间隙上加一个插入意向锁，否则一般情况下INSERT操作是不加锁的。那如果一个事务首先插入了一条记录（此时并没有与该记录关联的锁结构），然后另一个事务：</p>
<ul style="line-height: 160%; box-sizing: content-box; display: block; list-style-type: disc; padding-left: 30px; margin: 6px 0 10px; color: #333;">
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;">立即使用SELECT ... LOCK IN SHARE MODE语句读取这条事务，也就是在要获取这条记录的S锁，或者使用SELECT ... FOR UPDATE语句读取这条事务或者直接修改这条记录，也就是要获取这条记录的X锁，该咋办？<br/>
如果允许这种情况的发生，那么可能产生脏读问题。</p>
</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;">立即修改这条记录，也就是要获取这条记录的X锁，该咋办？<br/>
如果允许这种情况的发生，那么可能产生脏写问题。</p>
</li>
</ul>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">这时候我们前边唠叨了很多遍的事务id又要起作用了。我们把聚簇索引和二级索引中的记录分开看一下：</p>
<ul style="line-height: 160%; box-sizing: content-box; display: block; list-style-type: disc; padding-left: 30px; margin: 6px 0 10px; color: #333;">
<li style="line-height: 160%; box-sizing: content-box; position: relative;">情景一：对于聚簇索引记录来说，有一个trx_id隐藏列，该隐藏列记录着最后改动该记录的事务id。那么如果在当前事务中新插入一条聚簇索引记录后，该记录的trx_id隐藏列代表的的就是当前事务的事务id，如果其他事务此时想对该记录添加S锁或者X锁时，首先会看一下该记录的trx_id隐藏列代表的事务是否是当前的活跃事务，如果是的话，那么就帮助当前事务创建一个X锁（也就是为当前事务创建一个锁结构，is_waiting属性是false），然后自己进入等待状态（也就是为自己也创建一个锁结构，is_waiting属性是true）。</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">情景二：对于二级索引记录来说，本身并没有trx_id隐藏列，但是在二级索引页面的Page Header部分有一个PAGE_MAX_TRX_ID属性，该属性代表对该页面做改动的最大的事务id，如果PAGE_MAX_TRX_ID属性值小于当前最小的活跃事务id，那么说明对该页面做修改的事务都已经提交了，否则就需要在页面中定位到对应的二级索引记录，然后回表找到它对应的聚簇索引记录，然后再重复情景一的做法。</li>
</ul>
<h2 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 34px; border-bottom: 1px solid #dbdbdb; color: #333;">-------------------------------------------------</h2>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">通过上边的叙述我们知道，一个事务对新插入的记录可以不显式的加锁（生成一个锁结构），但是由于事务id这个牛逼的东东的存在，相当于加了一个隐式锁。别的事务在对这条记录加S锁或者X锁时，由于隐式锁的存在，会先帮助当前事务生成一个锁结构，然后自己再生成一个锁结构后进入等待状态。</p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">下边要看的是两种INSERT语句遇到的特殊情况：</p>
<h4 style="line-height: 160%; box-sizing: content-box; font-size: 20px; color: #333;">遇到重复键（duplicate key）</h4>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">在插入一条新记录时，首先要做的事情其实是定位到这条新记录应该插入到B+树的哪个位置。如果定位位置时发现了有已存在记录的主键或者唯一二级索引列与待插入记录的主键或者唯一二级索引列相同（不过可以有多条记录的唯一二级索引列的值同时为NULL），那么此时此时是会报错的。</p>
<ul style="line-height: 160%; box-sizing: content-box; display: block; list-style-type: disc; padding-left: 30px; margin: 6px 0 10px; color: #333;">
<li style="line-height: 160%; box-sizing: content-box; position: relative;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">主键索引重复</strong></li>
</ul>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">比方说我们插入新记录，该记录的主键值已经被包含在hero表中了：<img src="25-加锁分析_files/Image [15].png" type="image/png" data-filename="Image.png"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">当然，在生成报错信息前，其实还需要做一件非常重要的事情 —— <strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">无论是哪种隔离级别，对聚簇索引中number值为20的那条记录加S型Record Locks</strong>。</p>
<ul style="line-height: 160%; box-sizing: content-box; display: block; list-style-type: disc; padding-left: 30px; margin: 6px 0 10px; color: #333;">
<li style="line-height: 160%; box-sizing: content-box; position: relative;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">唯一二级索引重复</strong><br/>
在<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">READ UNCOMMITTED/READ COMMITTED</strong>隔离级别下，加的是<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">S型Record Locks</strong>。<br/>
在<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">REPEATABLE READ/SERIALIZABLE</strong>隔离级别下，加的是<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">S型next-key锁</strong>。</li>
</ul>
<h4 style="line-height: 160%; box-sizing: content-box; font-size: 20px; color: #333;">外键检查</h4>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">大家别忘了MySQL还是一个支持外键的数据库，比方说我们再为三国英雄的战马建一个表：<img src="25-加锁分析_files/Image [16].png" type="image/png" data-filename="Image.png"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">这样hero表就算是一个父表，新建的horse表就算一个子表，其中horse表的number列是参照hero表的number列。现在如果我们向子表中插入一条记录时：<br/>
<img src="25-加锁分析_files/Image [17].png" type="image/png" data-filename="Image.png"/><br/>
<img src="25-加锁分析_files/Image [18].png" type="image/png" data-filename="Image.png"/></p>
<h2 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 34px; border-bottom: 1px solid #dbdbdb; color: #333;">小结</h2>
<ol style="line-height: 160%; box-sizing: content-box; display: block; padding-left: 30px; margin: 6px 0 10px; color: #333; list-style-type: decimal;">
<li style="line-height: 160%; box-sizing: content-box;">在进行范围查询时，对于非主键索引，需要使用到<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">索引条件下推</strong>的特性；</li>
<li style="line-height: 160%; box-sizing: content-box;">对于<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">Repeatable Read/Serializable</strong>隔离级别下，使用<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">索引条件下推</strong>时，不满足下推条件的记录，并不释放锁；</li>
<li style="line-height: 160%; box-sizing: content-box;">对于<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">Repeatable Read/Serializable</strong>隔离级别下，对于有条件上限判断的语句，最后一个溢出判断的记录，不释放其锁；</li>
<li style="line-height: 160%; box-sizing: content-box;">对全表扫描的情况，<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">Read Uncommitted/Read Committed</strong>隔离级别下，在进行边界条件判断后，会将不满足条件的记录的锁释放掉；对于<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">Repeatable Read/Serializable</strong>隔离级别下，不会进行边界条件判断，直接对表中所有记录加</li>
<li style="line-height: 160%; box-sizing: content-box;">对于<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">update/delete</strong>操作，需要将操作相关联的其他索引记录也上锁；</li>
<li style="line-height: 160%; box-sizing: content-box;">只有<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">Repeatable Read/Serializable</strong>隔离级别下，才存在<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">Next-Key Locks/Gap Locks</strong>，并且只对<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">INSERT操作</strong>有限制作用，其他操作在获取Gap锁时不冲突。</li>
</ol>
</div><center style="display:none !important;visibility:collapse !important;height:0 !important;white-space:nowrap;width:100%;overflow:hidden">%23%23%23%23%20%E4%BA%8B%E5%89%8D%E5%87%86%E5%A4%87%0A%0A%0A%E5%BB%BA%E7%AB%8B%E4%B8%80%E4%B8%AA%E5%AD%98%E5%82%A8%E4%B8%89%E5%9B%BD%E8%8B%B1%E9%9B%84%E7%9A%84hero%E8%A1%A8%EF%BC%9A%0A!%5B1d553c8b911702c9e635bf4b5beabfb4.png%5D(en-resource%3A%2F%2Fdatabase%2F1217%3A1)%0A%0A%E7%84%B6%E5%90%8E%E5%90%91%E8%BF%99%E4%B8%AA%E8%A1%A8%E9%87%8C%E6%8F%92%E5%85%A5%E5%87%A0%E6%9D%A1%E8%AE%B0%E5%BD%95%EF%BC%9A%0A!%5Bb0bda9b9b0eef8c773d288556f03d591.png%5D(en-resource%3A%2F%2Fdatabase%2F1218%3A1)%0A%0A%E7%84%B6%E5%90%8E%E7%8E%B0%E5%9C%A8hero%E8%A1%A8%E5%B0%B1%E6%9C%89%E4%BA%86%E4%B8%A4%E4%B8%AA%E7%B4%A2%E5%BC%95%EF%BC%88%E4%B8%80%E4%B8%AA%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%EF%BC%8C%E4%B8%80%E4%B8%AA%E8%81%9A%E7%B0%87%E7%B4%A2%E5%BC%95%EF%BC%89%EF%BC%8C%E7%A4%BA%E6%84%8F%E5%9B%BE%E5%A6%82%E4%B8%8B%EF%BC%9A%0A!%5Befeb4051ff83dbfd8c4c4b9699ff8459.jpeg%5D(en-resource%3A%2F%2Fdatabase%2F1219%3A1)%0A%0A%23%23%23%23%20%E8%AF%AD%E5%8F%A5%E5%8A%A0%E9%94%81%E5%88%86%E6%9E%90%E7%9A%84%E5%89%8D%E7%BD%AE%E6%9D%A1%E4%BB%B6%0A%0A%E2%80%9CXXX%E8%AF%AD%E5%8F%A5%E8%AF%A5%E5%8A%A0%E4%BB%80%E4%B9%88%E9%94%81%E2%80%9D%E6%9C%AC%E8%BA%AB%E5%B0%B1%E6%98%AF%E4%B8%AA%E4%BC%AA%E5%91%BD%E9%A2%98%EF%BC%8C%E4%B8%80%E6%9D%A1%E8%AF%AD%E5%8F%A5%E9%9C%80%E8%A6%81%E5%8A%A0%E7%9A%84%E9%94%81%E5%8F%97%E5%88%B0%E5%BE%88%E5%A4%9A%E6%9D%A1%E4%BB%B6%E5%88%B6%E7%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4%BB%A5%E5%88%86%E4%B8%BA3%E5%A4%A7%E7%B1%BB%EF%BC%9A%0A%0A*%20%E5%BF%AB%E7%85%A7%E8%AF%BB%EF%BC%88%E6%99%AE%E9%80%9A%E7%9A%84select%E8%AF%AD%E5%8F%A5%EF%BC%89%0A*%20%E9%94%81%E5%AE%9A%E8%AF%BB%E3%80%81update%E3%80%81delete%E8%AF%AD%E5%8F%A5%0A*%20insert%E8%AF%AD%E5%8F%A5%0A%0A%0A%23%23%201%20%E5%BF%AB%E7%85%A7%E8%AF%BB%EF%BC%88%E6%99%AE%E9%80%9A%E7%9A%84select%E8%AF%AD%E5%8F%A5%EF%BC%89%0A%0A%23%23%23%201-1%20Read%20Uncommitted%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%0A%0A%E4%B8%8D%E5%8A%A0%E9%94%81%EF%BC%8C%E7%9B%B4%E6%8E%A5%E8%AF%BB%E5%8F%96%E8%AE%B0%E5%BD%95%E7%9A%84%E6%9C%80%E6%96%B0%E7%89%88%E6%9C%AC%EF%BC%8C%E5%8F%AF%E8%83%BD%E5%8F%91%E7%94%9F**%E8%84%8F%E8%AF%BB%E3%80%81%E4%B8%8D%E5%8F%AF%E9%87%8D%E5%A4%8D%E8%AF%BB%E5%92%8C%E5%B9%BB%E8%AF%BB**%E9%97%AE%E9%A2%98%E3%80%82%0A%0A%23%23%23%201-2%20Read%20Committed%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%0A%0A%E4%B8%8D%E5%8A%A0%E9%94%81%EF%BC%8C%E5%9C%A8%E6%AF%8F%E6%AC%A1%E6%89%A7%E8%A1%8C%E6%99%AE%E9%80%9A%E7%9A%84select%E8%AF%AD%E5%8F%A5%E6%97%B6%EF%BC%8C%E9%83%BD%E4%BC%9A%E7%94%9F%E6%88%90%E4%B8%80%E4%B8%AA**ReadView**%EF%BC%8C%E8%AF%BB%E5%8F%96%E7%89%88%E6%9C%AC%E9%93%BE%E4%B8%AD%E5%AF%B9%E8%AF%A5%E4%BA%8B%E5%8A%A1%E7%9A%84%E5%8F%AF%E8%A7%81%E7%89%88%E6%9C%AC%EF%BC%8C%E8%BF%99%E6%A0%B7%E8%A7%A3%E5%86%B3%E4%BA%86**%E8%84%8F%E8%AF%BB**%E9%97%AE%E9%A2%98%EF%BC%8C%E4%BD%86%E6%98%AF%E6%B2%A1%E6%9C%89%E8%A7%A3%E5%86%B3**%E4%B8%8D%E5%8F%AF%E9%87%8D%E5%A4%8D%E8%AF%BB**%E5%92%8C**%E5%B9%BB%E8%AF%BB**%E9%97%AE%E9%A2%98%E3%80%82%0A%0A%23%23%23%201-3%20Repeatable%20Read%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%0A%0A%E4%B8%8D%E5%8A%A0%E9%94%81%EF%BC%8C%E5%8F%AA%E5%9C%A8%E7%AC%AC%E4%B8%80%E6%AC%A1%E6%89%A7%E8%A1%8C%E6%99%AE%E9%80%9A%E7%9A%84select%E8%AF%AD%E5%8F%A5%E6%97%B6%EF%BC%8C%E7%94%9F%E6%88%90%E4%B8%80%E4%B8%AA**ReadView**%EF%BC%8C%E8%A7%A3%E5%86%B3%E4%BA%86**%E8%84%8F%E8%AF%BB%E3%80%81%E4%B8%8D%E5%8F%AF%E9%87%8D%E5%A4%8D%E8%AF%BB%E5%92%8C%E9%83%A8%E5%88%86%E5%B9%BB%E8%AF%BB**%E9%97%AE%E9%A2%98%E3%80%82%0A%0A%E4%B9%8B%E6%89%80%E4%BB%A5%E8%AF%B4%E6%98%AF%E9%83%A8%E5%88%86%E5%B9%BB%E8%AF%BB%EF%BC%8C%E4%B8%BB%E8%A6%81%E6%98%AF%E5%9B%A0%E4%B8%BA%E4%B8%8B%E9%9D%A2%E8%BF%99%E4%B8%AA%E4%BE%8B%E5%AD%90%EF%BC%9A%0A!%5Bce3244e471ca23074c16ab3cfb812819.png%5D(en-resource%3A%2F%2Fdatabase%2F1221%3A1)%0A%0A%E5%9C%A8Repeatable%20Read%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%E4%B8%8B%EF%BC%8CT1%E7%AC%AC%E4%B8%80%E6%AC%A1%E6%89%A7%E8%A1%8C%E6%99%AE%E9%80%9A%E7%9A%84select%E8%AF%AD%E5%8F%A5%E6%97%B6%E7%94%9F%E6%88%90%E4%BA%86%E4%B8%80%E4%B8%AA**ReadView**%EF%BC%8C%E4%B9%8B%E5%90%8ET2%E5%90%91hero%E8%A1%A8%E4%B8%AD%E6%96%B0%E6%8F%92%E5%85%A5%E4%BA%86%E4%B8%80%E6%9D%A1%E8%AE%B0%E5%BD%95%E4%BE%BF%E6%8F%90%E4%BA%A4%E4%BA%86%EF%BC%8C**ReadView**%E5%B9%B6%E4%B8%8D%E8%83%BD%E9%98%BB%E6%AD%A2T1%E6%89%A7%E8%A1%8C**update%E6%88%96%E8%80%85delete**%E8%AF%AD%E5%8F%A5%E6%9D%A5%E6%94%B9%E5%8A%A8%E8%BF%99%E4%B8%AA%E6%96%B0%E6%8F%92%E5%85%A5%E7%9A%84%E8%AE%B0%E5%BD%95%EF%BC%88%E5%9B%A0%E4%B8%BAT2%E5%B7%B2%E7%BB%8F%E6%8F%90%E4%BA%A4%EF%BC%8C%E6%94%B9%E5%8A%A8%E8%AF%A5%E8%AE%B0%E5%BD%95%E5%B9%B6%E4%B8%8D%E4%BC%9A%E9%80%A0%E6%88%90%E9%98%BB%E5%A1%9E%EF%BC%89%EF%BC%8C%E4%BD%86%E6%98%AF%E8%BF%99%E6%A0%B7%E4%B8%80%E6%9D%A5%E8%BF%99%E6%9D%A1%E6%96%B0%E8%AE%B0%E5%BD%95%E7%9A%84**trx_id**%E9%9A%90%E8%97%8F%E5%88%97%E5%B0%B1%E5%8F%98%E6%88%90%E4%BA%86T1%E7%9A%84**%E4%BA%8B%E5%8A%A1ID**%EF%BC%8C%E4%B9%8B%E5%90%8ET1%E4%B8%AD%E5%86%8D%E4%BD%BF%E7%94%A8%E6%99%AE%E9%80%9A%E7%9A%84select%E8%AF%AD%E5%8F%A5%E5%8E%BB%E6%9F%A5%E8%AF%A2%E8%BF%99%E6%9D%A1%E8%AE%B0%E5%BD%95%E6%97%B6%E5%B0%B1%E5%8F%AF%E4%BB%A5%E7%9C%8B%E5%88%B0%E8%BF%99%E6%9D%A1%E8%AE%B0%E5%BD%95%E4%BA%86%EF%BC%8C%E4%B9%9F%E5%B0%B1%E6%8A%8A%E8%BF%99%E6%9D%A1%E8%AE%B0%E5%BD%95%E8%BF%94%E5%9B%9E%E7%BB%99%E5%AE%A2%E6%88%B7%E7%AB%AF%E4%BA%86%E3%80%82%E5%9B%A0%E4%B8%BA%E8%BF%99%E4%B8%AA%E7%89%B9%E6%AE%8A%E7%8E%B0%E8%B1%A1%E7%9A%84%E5%AD%98%E5%9C%A8%EF%BC%8C%E4%B9%9F%E5%8F%AF%E4%BB%A5%E8%AE%A4%E4%B8%BAInnoDB%E4%B8%AD**MVCC%E4%B8%8D%E8%83%BD%E5%AE%8C%E5%AE%8C%E5%85%A8%E5%85%A8%E7%9A%84%E7%A6%81%E6%AD%A2%E5%B9%BB%E8%AF%BB**%E3%80%82%0A%0A%23%23%23%201-4%20Serializable%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%0A%0A*%20%E5%9C%A8%E7%B3%BB%E7%BB%9F%E5%8F%98%E9%87%8Fautocommit%20%3D%200%E6%97%B6%EF%BC%8C%E5%8D%B3%E7%A6%81%E7%94%A8%E8%87%AA%E5%8A%A8%E6%8F%90%E4%BA%A4%E6%97%B6%EF%BC%8C%E6%99%AE%E9%80%9A%E7%9A%84select%E8%AF%AD%E5%8F%A5%E4%BC%9A%E8%A2%AB%E8%BD%AC%E4%B8%BA**select%20...%20...%20lock%20in%20share%20mode**%E8%AF%AD%E5%8F%A5%EF%BC%8C%E5%B0%B1%E6%98%AF%E5%9C%A8%E8%AF%BB%E5%8F%96%E8%AE%B0%E5%BD%95%E5%89%8D%E9%9C%80%E8%A6%81%E5%85%88%E8%8E%B7%E5%BE%97%E8%AE%B0%E5%BD%95%E7%9A%84**S%E9%94%81**%EF%BC%8C%E5%85%B7%E4%BD%93%E7%9A%84%E5%8A%A0%E9%94%81%E6%83%85%E5%86%B5%E5%92%8CRepeatable%20Read%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%E4%B8%80%E6%A0%B7%EF%BC%8C%E4%B8%8B%E9%9D%A2%E5%88%86%E6%9E%90%E3%80%82%0A*%20%E5%9C%A8%E7%B3%BB%E7%BB%9F%E5%8F%98%E9%87%8Fautocommit%20%3D%201%E6%97%B6%EF%BC%8C%E5%8D%B3%E5%90%AF%E7%94%A8%E8%87%AA%E5%8A%A8%E6%8F%90%E4%BA%A4%E6%97%B6%EF%BC%8C%E6%99%AE%E9%80%9A%E7%9A%84select%E8%AF%AD%E5%8F%A5%E5%B9%B6%E4%B8%8D%E5%8A%A0%E9%94%81%EF%BC%8C%E5%8F%AA%E5%88%A9%E7%94%A8MVCC%E7%94%9F%E6%88%90%E4%B8%80%E4%B8%AA**ReadView**%E5%8E%BB%E8%AF%BB%E5%8F%96%E8%AE%B0%E5%BD%95%E3%80%82%0A%0A%E4%B8%BA%E4%BB%80%E4%B9%88%E5%9C%A8%E7%B3%BB%E7%BB%9F%E5%8F%98%E9%87%8Fautocommit%20%3D%201%E6%97%B6%E4%B8%8D%E5%8A%A0%E9%94%81%E5%91%A2%EF%BC%9F%E5%9B%A0%E4%B8%BA%E5%90%AF%E7%94%A8%E8%87%AA%E5%8A%A8%E6%8F%90%E4%BA%A4%E6%84%8F%E5%91%B3%E7%9D%80%E4%B8%80%E4%B8%AA%E4%BA%8B%E5%8A%A1%E4%B8%AD%E5%8F%AA%E5%8C%85%E5%90%AB%E4%B8%80%E6%9D%A1%E8%AF%AD%E5%8F%A5%EF%BC%8C%E4%B8%80%E6%9D%A1%E8%AF%AD%E5%8F%A5%E5%B0%B1%E4%B8%8D%E5%AD%98%E5%9C%A8**%E4%B8%8D%E5%8F%AF%E9%87%8D%E5%A4%8D%E8%AF%BB%E3%80%81%E5%B9%BB%E8%AF%BB**%E7%9A%84%E9%97%AE%E9%A2%98%E4%BA%86%E3%80%82%0A%0A%23%23%202%20%E9%94%81%E5%AE%9A%E8%AF%BB%E3%80%81update%E3%80%81delete%E8%AF%AD%E5%8F%A5%0A%0A*%20%E8%AF%AD%E5%8F%A5%E4%B8%80%EF%BC%9ASELECT%20...%20...%20LOCK%20IN%20SHARE%20MODE%EF%BC%9B%0A*%20%E8%AF%AD%E5%8F%A5%E4%BA%8C%EF%BC%9ASELECT%20...%20...%20FOR%20UPDATE%EF%BC%9B%0A*%20%E8%AF%AD%E5%8F%A5%E4%B8%89%EF%BC%9AUPDATE%20...%20...%20%EF%BC%9B%0A*%20%E8%AF%AD%E5%8F%A5%E5%9B%9B%EF%BC%9ADELETE%20...%20...%20%EF%BC%9B%0A%0A%E8%AF%AD%E5%8F%A5%E4%B8%80%E5%92%8C%E8%AF%AD%E5%8F%A5%E4%BA%8C%E6%98%AFMySQL%E4%B8%AD%E8%A7%84%E5%AE%9A%E7%9A%84%E4%B8%A4%E7%A7%8D**%E9%94%81%E5%AE%9A%E8%AF%BB**%E7%9A%84%E8%AF%AD%E5%8F%A5%E6%A0%BC%E5%BC%8F%EF%BC%8C%E8%80%8C%E8%AF%AD%E5%8F%A5%E4%B8%89%E5%92%8C%E8%AF%AD%E5%8F%A5%E5%9B%9B%E7%94%B1%E4%BA%8E%E5%9C%A8%E6%89%A7%E8%A1%8C%E8%BF%87%E7%A8%8B%E9%9C%80%E8%A6%81%E9%A6%96%E5%85%88%E5%AE%9A%E4%BD%8D%E5%88%B0%E8%A2%AB%E6%94%B9%E5%8A%A8%E7%9A%84%E8%AE%B0%E5%BD%95%E5%B9%B6%E7%BB%99%E8%AE%B0%E5%BD%95%E5%8A%A0%E9%94%81%EF%BC%8C%E4%B9%9F%E5%8F%AF%E4%BB%A5%E8%A2%AB%E8%AE%A4%E4%B8%BA%E6%98%AF%E4%B8%80%E7%A7%8D**%E9%94%81%E5%AE%9A%E8%AF%BB**%E3%80%82%0A%0A%23%23%23%202-1%20Read%20Uncommitted%2FRead%20Committed%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%0A%0A%E5%9C%A8READ%20UNCOMMITTED%E4%B8%8B%E8%AF%AD%E5%8F%A5%E7%9A%84%E5%8A%A0%E9%94%81%E6%96%B9%E5%BC%8F%E5%92%8CREAD%20COMMITTED%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%E4%B8%8B%E8%AF%AD%E5%8F%A5%E7%9A%84%E5%8A%A0%E9%94%81%E6%96%B9%E5%BC%8F%E5%9F%BA%E6%9C%AC%E4%B8%80%E8%87%B4%EF%BC%8C%E6%89%80%E4%BB%A5%E5%B0%B1%E6%94%BE%E5%88%B0%E4%B8%80%E5%9D%97%E5%84%BF%E8%AF%B4%E4%BA%86%E3%80%82%E5%80%BC%E5%BE%97%E6%B3%A8%E6%84%8F%E7%9A%84%E6%98%AF%EF%BC%8C%E9%87%87%E7%94%A8%E5%8A%A0%E9%94%81%E6%96%B9%E5%BC%8F%E8%A7%A3%E5%86%B3%E5%B9%B6%E5%8F%91%E4%BA%8B%E5%8A%A1%E5%B8%A6%E6%9D%A5%E7%9A%84%E9%97%AE%E9%A2%98%E6%97%B6%EF%BC%8C%E5%85%B6%E5%AE%9E**%E8%84%8F%E8%AF%BB%E5%92%8C%E4%B8%8D%E5%8F%AF%E9%87%8D%E5%A4%8D%E8%AF%BB**%E5%9C%A8%E4%BB%BB%E4%BD%95%E4%B8%80%E4%B8%AA%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%E4%B8%8B%E9%83%BD%E4%B8%8D%E4%BC%9A%E5%8F%91%E7%94%9F%EF%BC%88%E5%9B%A0%E4%B8%BA%E8%AF%BB-%E5%86%99%E6%93%8D%E4%BD%9C%E9%9C%80%E8%A6%81%E6%8E%92%E9%98%9F%E8%BF%9B%E8%A1%8C%EF%BC%89%E3%80%82%0A%0A%23%23%23%23%202-1-1%20%E5%AF%B9%E4%B8%BB%E9%94%AE%E8%BF%9B%E8%A1%8C%E7%AD%89%E5%80%BC%E6%9F%A5%E8%AF%A2%0A%0A%23%23%23%23%23%20%E4%BD%BF%E7%94%A8SELECT%20.%20.%20.%20LOCK%20IN%20SHARE%20MODE%E4%B8%BA%E8%AE%B0%E5%BD%95%E5%8A%A0%E9%94%81%0A%0A%E4%BE%8B%EF%BC%9A%0ASELECT%20*%20FROM%20hero%20WHERE%20numer%20%3D%208%20LOCK%20IN%20SHARE%20MODE%EF%BC%9B%0A%0A%E8%BF%99%E4%B8%AA%E8%AF%AD%E5%8F%A5%E6%89%A7%E8%A1%8C%E6%97%B6%E5%8F%AA%E9%9C%80%E8%A6%81%E8%AE%BF%E9%97%AE%E4%B8%80%E4%B8%8B%E8%81%9A%E7%B0%87%E7%B4%A2%E5%BC%95%E4%B8%ADnumber%E5%80%BC%E4%B8%BA8%E7%9A%84%E8%AE%B0%E5%BD%95%EF%BC%8C%E6%89%80%E4%BB%A5%E5%8F%AA%E9%9C%80%E8%A6%81%E7%BB%99%E8%81%9A%E7%B0%87%E7%B4%A2%E5%BC%95%E4%B8%ADnumer%E5%80%BC%E4%B8%BA8%E7%9A%84%E8%AE%B0%E5%BD%95%E5%8A%A0%E4%B8%80%E4%B8%AA**S%E5%9E%8BRecord%20Locks**%E3%80%82%0A%0A!%5B80b73b1d5fd3ef4eca9ccfb727630961.jpeg%5D(en-resource%3A%2F%2Fdatabase%2F1223%3A1)%0A%0A%0A%23%23%23%23%23%20%E4%BD%BF%E7%94%A8SELECT%20.%20.%20.%20FOR%20UPDATE%E4%B8%BA%E8%AE%B0%E5%BD%95%E5%8A%A0%E9%94%81%0A%0A%E4%BE%8B%EF%BC%9A%0ASELECT%20*%20FROM%20hero%20WHERE%20numer%20%3D%208%20FOR%20UPDATE%EF%BC%9B%0A%0A%E8%BF%99%E4%B8%AA%E8%AF%AD%E5%8F%A5%E6%89%A7%E8%A1%8C%E6%97%B6%E5%8F%AA%E9%9C%80%E8%A6%81%E8%AE%BF%E9%97%AE%E4%B8%80%E4%B8%8B%E8%81%9A%E7%B0%87%E7%B4%A2%E5%BC%95%E4%B8%ADnumber%E5%80%BC%E4%B8%BA8%E7%9A%84%E8%AE%B0%E5%BD%95%EF%BC%8C%E6%89%80%E4%BB%A5%E5%8F%AA%E9%9C%80%E8%A6%81%E7%BB%99%E8%81%9A%E7%B0%87%E7%B4%A2%E5%BC%95%E4%B8%ADnumer%E5%80%BC%E4%B8%BA8%E7%9A%84%E8%AE%B0%E5%BD%95%E5%8A%A0%E4%B8%80%E4%B8%AA**X%E5%9E%8BRecord%20Locks**%E3%80%82!%5B52ac46a04fa26408a495d5ee8adf794c.jpeg%5D(en-resource%3A%2F%2Fdatabase%2F1225%3A1)%0A%0A%0A%23%23%23%23%23%20%E4%BD%BF%E7%94%A8UPDATE%E4%B8%BA%E8%AE%B0%E5%BD%95%E5%8A%A0%E9%94%81%0A%0A1.%20**%E6%B2%A1%E6%9C%89%E6%9B%B4%E6%96%B0%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E5%88%97**%0A%E4%BE%8B%EF%BC%9A%0AUPDATE%20hero%20SET%20country%20%3D%20'%E6%B1%89'%20WHERE%20numer%20%3D%208%EF%BC%9B%0A%E5%8A%A0%E9%94%81%E6%96%B9%E5%BC%8F%E4%B8%8E%E4%B8%8A%E8%BF%B0%E7%9A%84**for%20update**%E8%AF%AD%E5%8F%A5%E5%8A%A0%E9%94%81%E6%96%B9%E5%BC%8F%E4%B8%80%E8%87%B4%EF%BC%8C%E4%BB%85%E4%BB%85%E4%B8%BA%E8%81%9A%E7%B0%87%E7%B4%A2%E5%BC%95%E4%B8%ADnumer%E5%80%BC%E4%B8%BA8%E7%9A%84%E8%AE%B0%E5%BD%95%E5%8A%A0%E4%B8%80%E4%B8%AA**X%E5%9E%8BRecord%20Locks**%E3%80%82%0A%0A2.%20%20**%E6%9B%B4%E6%96%B0%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E5%88%97**%0A%E4%BE%8B%EF%BC%9A%0AUPDATE%20hero%20SET%20name%20%3D%20'cao%E6%9B%B9%E6%93%8D'%20WHERE%20number%20%3D%208%EF%BC%9B%0A%E8%AF%A5%E8%AF%AD%E5%8F%A5%E7%9A%84%E5%AE%9E%E9%99%85%E6%89%A7%E8%A1%8C%E6%AD%A5%E9%AA%A4%E6%98%AF%E9%A6%96%E5%85%88%E6%9B%B4%E6%96%B0%E5%AF%B9%E5%BA%94%E7%9A%84number%E5%80%BC%E4%B8%BA8%E7%9A%84%E8%81%9A%E7%B0%87%E7%B4%A2%E5%BC%95%E8%AE%B0%E5%BD%95%EF%BC%8C%E5%86%8D%E6%9B%B4%E6%96%B0%E5%AF%B9%E5%BA%94%E7%9A%84%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E8%AE%B0%E5%BD%95%EF%BC%8C%E6%89%80%E4%BB%A5%E5%8A%A0%E9%94%81%E7%9A%84%E6%AD%A5%E9%AA%A4%E5%B0%B1%E6%98%AF%EF%BC%9A%0A*%20%E4%B8%BAnumber%E5%80%BC%E4%B8%BA8%E5%AF%B9%E5%BA%94%E7%9A%84%E8%81%9A%E7%B0%87%E7%B4%A2%E5%BC%95%E8%AE%B0%E5%BD%95%E5%8A%A0%E4%B8%8A**X%E5%9E%8BRecord%20Locks**%E3%80%82%0A*%20%E4%B8%BA%E8%AF%A5%E8%81%9A%E7%B0%87%E7%B4%A2%E5%BC%95%E8%AE%B0%E5%BD%95%E5%AF%B9%E5%BA%94%E7%9A%84idx_name%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E8%AE%B0%E5%BD%95%EF%BC%88%E4%B9%9F%E5%B0%B1%E6%98%AFname%E5%80%BC%E4%B8%BA'c%E6%9B%B9%E6%93%8D'%EF%BC%8Cnumber%E5%80%BC%E4%B8%BA8%E7%9A%84%E9%82%A3%E6%9D%A1%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E8%AE%B0%E5%BD%95%EF%BC%89%E5%8A%A0%E4%B8%8A**X%E5%9E%8BRecord%20Locks**%E3%80%82%0A!%5Bdd35766343cd50df94a87df84d1d9a8d.jpeg%5D(en-resource%3A%2F%2Fdatabase%2F1227%3A1)%0A%0A%23%23%23%23%23%20%E4%BD%BF%E7%94%A8DELETE%E4%B8%BA%E8%AE%B0%E5%BD%95%E5%8A%A0%E9%94%81%0A%0A%E4%BE%8B%EF%BC%9A%0ADELETE%20FROM%20hero%20WHERE%20number%20%3D%208%EF%BC%9B%0A%0A%E5%B9%B3%E6%97%B6%E6%89%80%E8%AF%B4%E7%9A%84%E2%80%9CDELETE%E8%A1%A8%E4%B8%AD%E7%9A%84%E4%B8%80%E6%9D%A1%E8%AE%B0%E5%BD%95%E2%80%9D%E5%85%B6%E5%AE%9E%E6%84%8F%E5%91%B3%E7%9D%80%E5%AF%B9%E8%81%9A%E7%B0%87%E7%B4%A2%E5%BC%95%E5%92%8C%E6%89%80%E6%9C%89%E7%9A%84%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E4%B8%AD%E5%AF%B9%E5%BA%94%E7%9A%84%E8%AE%B0%E5%BD%95%E5%81%9ADELETE%E6%93%8D%E4%BD%9C%EF%BC%8C%E6%9C%AC%E4%BE%8B%E5%AD%90%E4%B8%AD%E5%B0%B1%E6%98%AF%E8%A6%81%E5%85%88%E6%8A%8Anumber%E5%80%BC%E4%B8%BA8%E7%9A%84%E8%81%9A%E7%B0%87%E7%B4%A2%E5%BC%95%E8%AE%B0%E5%BD%95%E6%89%A7%E8%A1%8CDELETE%E6%93%8D%E4%BD%9C%EF%BC%8C%E7%84%B6%E5%90%8E%E6%8A%8A%E5%AF%B9%E5%BA%94%E7%9A%84idx_name%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E8%AE%B0%E5%BD%95%E5%88%A0%E9%99%A4%EF%BC%8C%E6%89%80%E4%BB%A5%E5%8A%A0%E9%94%81%E7%9A%84%E6%AD%A5%E9%AA%A4%E5%92%8C%E4%B8%8A%E8%BE%B9%E6%9B%B4%E6%96%B0%E5%B8%A6%E6%9C%89%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E5%88%97%E7%9A%84UPDATE%E8%AF%AD%E5%8F%A5%E4%B8%80%E8%87%B4%E3%80%82%0A%0A%0A%23%23%23%23%202-1-2%20%E5%AF%B9%E4%B8%BB%E9%94%AE%E8%BF%9B%E8%A1%8C%E8%8C%83%E5%9B%B4%E6%9F%A5%E8%AF%A2%0A%0A%23%23%23%23%23%20%E4%BD%BF%E7%94%A8SELECT%20.%20.%20.%20LOCK%20IN%20SHARE%20MODE%E4%B8%BA%E8%AE%B0%E5%BD%95%E5%8A%A0%E9%94%81%0A%E4%BE%8B%EF%BC%9A%0ASELECT%20*%20FROM%20hero%20WHERE%20number%20%3C%3D%208%20LOCK%20IN%20SHARE%20MODE%EF%BC%9B%0A%0A1.%20%E5%85%88%E5%88%B0%E8%81%9A%E7%B0%87%E7%B4%A2%E5%BC%95%E4%B8%AD%E5%AE%9A%E4%BD%8D%E5%88%B0%E6%BB%A1%E8%B6%B3number%20%3C%3D%208%E7%9A%84%E7%AC%AC%E4%B8%80%E6%9D%A1%E8%AE%B0%E5%BD%95%EF%BC%8C%E4%B9%9F%E5%B0%B1%E6%98%AFnumber%E5%80%BC%E4%B8%BA1%E7%9A%84%E8%AE%B0%E5%BD%95%EF%BC%8C%E7%84%B6%E5%90%8E%E4%B8%BA%E5%85%B6%E5%8A%A0%E9%94%81%E3%80%82%0A%0A2.%20%E5%88%A4%E6%96%AD%E4%B8%80%E4%B8%8B%E8%AF%A5%E8%AE%B0%E5%BD%95%E6%98%AF%E5%90%A6%E7%AC%A6%E5%90%88**%E7%B4%A2%E5%BC%95%E6%9D%A1%E4%BB%B6%E4%B8%8B%E6%8E%A8**%E4%B8%AD%E7%9A%84%E6%9D%A1%E4%BB%B6%E3%80%82%0A%E5%89%8D%E8%BE%B9%E4%BB%8B%E7%BB%8D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B6%E8%BF%94%E5%9B%9E%E7%BB%99**server%E5%B1%82**%E7%BB%A7%E7%BB%AD%E5%A4%84%E7%90%86%EF%BC%8C%E5%90%A6%E5%88%99%E7%9A%84%E8%AF%9D%E9%9C%80%E8%A6%81%E9%87%8A%E6%94%BE%E6%8E%89%E5%9C%A8%E8%AF%A5%E8%AE%B0%E5%BD%95%E4%B8%8A%E5%8A%A0%E7%9A%84%E9%94%81%EF%BC%8C%E5%B9%B6%E7%BB%99server%E5%B1%82%E8%BF%94%E5%9B%9E%E4%B8%80%E4%B8%AA%E6%9F%A5%E8%AF%A2%E5%AE%8C%E6%AF%95%E7%9A%84%E4%BF%A1%E6%81%AF%E3%80%82%0A%E5%AF%B9%E4%BA%8Enumber%E5%80%BC%E4%B8%BA1%E7%9A%84%E8%AE%B0%E5%BD%95%E6%98%AF%E7%AC%A6%E5%90%88%E8%BF%99%E4%B8%AA%E6%9D%A1%E4%BB%B6%E7%9A%84%EF%BC%8C%E6%89%80%E4%BB%A5%E4%BC%9A%E5%B0%86%E5%85%B6%E8%BF%94%E5%9B%9E%E5%88%B0server%E5%B1%82%E7%BB%A7%E7%BB%AD%E5%A4%84%E7%90%86%E3%80%82%0A%0A4.%20%E5%B0%86%E8%AF%A5%E8%AE%B0%E5%BD%95%E8%BF%94%E5%9B%9E%E5%88%B0server%E5%B1%82%E7%BB%A7%E7%BB%AD%E5%88%A4%E6%96%AD%E3%80%82%0Aserver%E5%B1%82%E5%A6%82%E6%9E%9C%E6%94%B6%E5%88%B0%E5%AD%98%E5%82%A8%E5%BC%95%E6%93%8E%E5%B1%82%E6%8F%90%E4%BE%9B%E7%9A%84%E6%9F%A5%E8%AF%A2%E5%AE%8C%E6%AF%95%E7%9A%84%E4%BF%A1%E6%81%AF%EF%BC%8C%E5%B0%B1%E7%BB%93%E6%9D%9F%E6%9F%A5%E8%AF%A2%EF%BC%8C%E5%90%A6%E5%88%99%E7%BB%A7%E7%BB%AD%E5%88%A4%E6%96%AD%E9%82%A3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E7%9A%84%E6%9D%A1%E4%BB%B6%EF%BC%88%E6%B2%A1%E6%9C%89%E8%BF%9B%E8%A1%8C%E7%B4%A2%E5%BC%95%E6%9D%A1%E4%BB%B6%E4%B8%8B%E6%8E%A8%E7%9A%84%E6%9D%A1%E4%BB%B6%EF%BC%89%EF%BC%8C%E9%82%A3%E4%B9%88%E5%B0%B1%E6%8A%8A%E5%AE%83%E5%8F%91%E9%80%81%E7%BB%99%E5%AE%A2%E6%88%B7%E7%AB%AF%EF%BC%8C%E4%B8%8D%E7%84%B6%E7%9A%84%E8%AF%9D%E9%9C%80%E8%A6%81%E9%87%8A%E6%94%BE%E6%8E%89%E5%9C%A8%E8%AF%A5%E8%AE%B0%E5%BD%95%E4%B8%8A%E5%8A%A0%E7%9A%84%E9%94%81%E3%80%82%0A%0A5.%20%E7%84%B6%E5%90%8E%E5%88%9A%E5%88%9A%E6%9F%A5%E8%AF%A2%E5%BE%97%E5%88%B0%E7%9A%84%E8%BF%99%E6%9D%A1%E8%AE%B0%E5%BD%95%EF%BC%88%E4%B9%9F%E5%B0%B1%E6%98%AFnumber%E5%80%BC%E4%B8%BA1%E7%9A%84%E8%AE%B0%E5%BD%95%EF%BC%89%E7%BB%84%E6%88%90%E7%9A%84%E5%8D%95%E5%90%91%E9%93%BE%E8%A1%A8%E7%BB%A7%E7%BB%AD%E5%90%91%E5%90%8E%E6%9F%A5%E6%89%BE%EF%BC%8C%E5%BE%97%E5%88%B0%E4%BA%86number%E5%80%BC%E4%B8%BA3%E7%9A%84%E8%AE%B0%E5%BD%95%EF%BC%8C%E7%84%B6%E5%90%8E%E9%87%8D%E5%A4%8D%E7%AC%AC2%EF%BC%8C3%EF%BC%8C4%E3%80%815%E8%BF%99%E5%87%A0%E4%B8%AA%E6%AD%A5%E9%AA%A4%E3%80%82!%5B0cc43248da8ea446a20aabe5a2988d4f.png%5D(en-resource%3A%2F%2Fdatabase%2F1229%3A1)%0A%0A%0A%E4%BD%86%E6%98%AF%E8%BF%99%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9A%84%E8%AE%B0%E5%BD%95%E5%85%88%E8%A2%AB%E5%8A%A0%E9%94%81%EF%BC%8C%E7%84%B6%E5%90%8E%E6%8A%8A%E9%94%81%E9%87%8A%E6%94%BE%E6%8E%89%EF%BC%8C%E8%BF%87%E7%A8%8B%E5%B0%B1%E6%98%AF%E8%BF%99%E6%A0%B7%EF%BC%9A!%5B3d5932cb74ab8bab69ce12f84abc13ee.jpeg%5D(en-resource%3A%2F%2Fdatabase%2F1231%3A1)%0A%0A%0A%E8%BF%99%E4%B8%AA%E8%BF%87%E7%A8%8B%E6%9C%89%E6%84%8F%E6%80%9D%E7%9A%84%E4%B8%80%E7%82%B9%E5%B0%B1%E6%98%AF%EF%BC%8C%E5%A6%82%E6%9E%9C%E4%BD%A0%E5%85%88%E5%9C%A8%E4%BA%8B%E5%8A%A1T1%E4%B8%AD%E6%89%A7%E8%A1%8C%EF%BC%9A!%5B7cfe8b1a15f2ce25e775fe15be134cfb.png%5D(en-resource%3A%2F%2Fdatabase%2F1233%3A1)%0A%0A%E7%84%B6%E5%90%8E%E5%86%8D%E5%88%B0%E4%BA%8B%E5%8A%A1T2%E4%B8%AD%E6%89%A7%E8%A1%8C%EF%BC%9A!%5B7d32dfc335c2d015bec0a057a8056451.png%5D(en-resource%3A%2F%2Fdatabase%2F1235%3A1)%0A%0A%E6%98%AF%E6%B2%A1%E6%9C%89%E9%97%AE%E9%A2%98%E7%9A%84%EF%BC%8C%E5%9B%A0%E4%B8%BA%E5%9C%A8T2%E6%89%A7%E8%A1%8C%E6%97%B6%EF%BC%8C%E4%BA%8B%E5%8A%A1T1%E5%B7%B2%E7%BB%8F%E9%87%8A%E6%94%BE%E6%8E%89%E4%BA%86number%E5%80%BC%E4%B8%BA15%E7%9A%84%E8%AE%B0%E5%BD%95%E7%9A%84%E9%94%81%EF%BC%8C**%E4%BD%86%E6%98%AF%E5%A6%82%E6%9E%9C%E4%BD%A0%E5%85%88%E6%89%A7%E8%A1%8CT2%EF%BC%8C%E5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%8E%8B%E6%A0%B9%E5%84%BF%E6%B2%A1%E7%BB%99%E8%BF%99%E6%9D%A1%E8%AE%B0%E5%BD%95%E5%8A%A0%E9%94%81%EF%BC%89%E3%80%82%E6%95%B4%E4%B8%AA%E8%BF%87%E7%A8%8B%E4%BC%9A%E7%BB%99number%E5%80%BC%E4%B8%BA8%E3%80%8115%E3%80%8120%E8%BF%99%E4%B8%89%E6%9D%A1%E8%AE%B0%E5%BD%95%E5%8A%A0%E4%B8%8AS%E5%9E%8BRecord%20Locks%EF%BC%8C%E7%94%BB%E4%B8%AA%E5%9B%BE%E8%A1%A8%E7%A4%BA%E4%B8%80%E4%B8%8B%E5%B0%B1%E6%98%AF%E8%BF%99%E6%A0%B7%EF%BC%9A!%5B8ce3f7a4cd1166d32e8c2eae9bb1c2c5.jpeg%5D(en-resource%3A%2F%2Fdatabase%2F1239%3A1)%0A%0A%23%23%23%23%23%20%E4%BD%BF%E7%94%A8SELECT%20.%20.%20.%20FOR%20UPDATE%E4%B8%BA%E8%AE%B0%E5%BD%95%E5%8A%A0%E9%94%81%0A%0A%E5%92%8CSELECT%20...%20FOR%20UPDATE%E8%AF%AD%E5%8F%A5%E7%B1%BB%E4%BC%BC%EF%BC%8C%E5%8F%AA%E4%B8%8D%E8%BF%87%E5%8A%A0%E7%9A%84%E6%98%AF**X%E5%9E%8BRecord%20Locks**%E3%80%82%0A%0A%23%23%23%23%23%20%E4%BD%BF%E7%94%A8UPDATE%E6%9D%A5%E4%B8%BA%E8%AE%B0%E5%BD%95%E5%8A%A0%E9%94%81%0A1.%20**%E6%B2%A1%E6%9C%89%E6%9B%B4%E6%96%B0%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95**%0A%E4%BE%8B%EF%BC%9A%0AUPDATE%20hero%20SET%20country%20%3D%20'%E6%B1%89'%20WHERE%20number%20%3E%3D%208%EF%BC%9B%0A%E8%BF%99%E6%9D%A1UPDATE%E8%AF%AD%E5%8F%A5%E5%B9%B6%E6%B2%A1%E6%9C%89%E6%9B%B4%E6%96%B0%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E5%88%97%EF%BC%8C%E5%8A%A0%E9%94%81%E6%96%B9%E5%BC%8F%E5%92%8C%E4%B8%8A%E8%BE%B9%E6%89%80%E8%AF%B4%E7%9A%84SELECT%20...%20FOR%20UPDATE%E8%AF%AD%E5%8F%A5%E4%B8%80%E8%87%B4%E3%80%82%0A%0A2.%20**%E6%9B%B4%E6%96%B0%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95**%0A%E4%BE%8B%EF%BC%9A%0AUPDATE%20hero%20SET%20name%20%3D%20'cao%E6%9B%B9%E6%93%8D'%20WHERE%20number%20%3E%3D%208%EF%BC%9B%0A%E8%BF%99%E6%97%B6%E5%80%99%E4%BC%9A%E9%A6%96%E5%85%88%E6%9B%B4%E6%96%B0%E8%81%9A%E7%B0%87%E7%B4%A2%E5%BC%95%E8%AE%B0%E5%BD%95%EF%BC%8C%E5%86%8D%E6%9B%B4%E6%96%B0%E5%AF%B9%E5%BA%94%E7%9A%84%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E8%AE%B0%E5%BD%95%EF%BC%8C%E6%89%80%E4%BB%A5%E5%8A%A0%E9%94%81%E7%9A%84%E6%AD%A5%E9%AA%A4%E5%B0%B1%E6%98%AF%EF%BC%9A!%5B5a3d2b3634e0cbd268ccdf7c148cae99.png%5D(en-resource%3A%2F%2Fdatabase%2F1241%3A1)!%5B36d2906a0b9dfac6157cc656d5be8737.jpeg%5D(en-resource%3A%2F%2Fdatabase%2F1243%3A1)%0A%0A%E5%A6%82%E6%9E%9C%E6%98%AF%E4%B8%8B%E8%BE%B9%E8%BF%99%E4%B8%AA%E8%AF%AD%E5%8F%A5%EF%BC%9AUPDATE%20hero%20SET%20namey%20%3D%20'%E6%B1%89'%20WHERE%20number%20%3C%3D%208%EF%BC%9B%0A%E5%88%99%E4%BC%9A%E5%AF%B9number%E5%80%BC%E4%B8%B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%AF%A5%E8%81%9A%E7%B0%87%E7%B4%A2%E5%BC%95%E8%AE%B0%E5%BD%95%E4%B8%8A%E7%9A%84%E9%94%81%EF%BC%88%E6%B3%A8%E6%84%8F%E8%BF%99%E4%B8%AA%E8%BF%87%E7%A8%8B%E4%B8%AD%E6%B2%A1%E6%9C%89%E5%AF%B9number%E5%80%BC%E4%B8%BA15%E7%9A%84%E8%81%9A%E7%B0%87%E7%B4%A2%E5%BC%95%E8%AE%B0%E5%BD%95%E5%AF%B9%E5%BA%94%E7%9A%84%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E8%AE%B0%E5%BD%95%E5%8A%A0%E9%94%81%EF%BC%89%E3%80%82%0A%0A%23%23%23%23%23%20%E4%BD%BF%E7%94%A8UPDATE%E6%9D%A5%E4%B8%BA%E8%AE%B0%E5%BD%95%E5%8A%A0%E9%94%81%0A%E4%BE%8B%EF%BC%9A%0ADELETE%20FROM%20hero%20WHERE%20number%20%3E%3D%208%EF%BC%9B%0A%E5%92%8C%0ADELETE%20FROM%20hero%20WHERE%20number%20%3C%3D%208%EF%BC%9B%0A%0A%E8%BF%99%E4%B8%A4%E4%B8%AA%E8%AF%AD%E5%8F%A5%E7%9A%84%E5%8A%A0%E9%94%81%E6%83%85%E5%86%B5%E5%92%8C%E6%9B%B4%E6%96%B0%E5%B8%A6%E6%9C%89%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E5%88%97%E7%9A%84UPDATE%E8%AF%AD%E5%8F%A5%E4%B8%80%E8%87%B4%EF%BC%8C%E4%BD%86%E9%9C%80%E8%A6%81%E6%B3%A8%E6%84%8F%E7%9A%84%E6%98%AF%EF%BC%8Cdelete%E6%93%8D%E4%BD%9C%E8%A6%81%E5%A4%9A%E6%89%80%E6%9C%89%E7%9A%84%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E4%B8%AD%E7%9B%B8%E5%BA%94%E7%9A%84%E8%AE%B0%E5%BD%95%E5%8A%A0%E9%94%81%E3%80%82%0A%0A%0A%23%23%23%23%202-1-3%20%E4%BD%BF%E7%94%A8%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E8%BF%9B%E8%A1%8C%E7%AD%89%E5%80%BC%E6%9F%A5%E6%89%BE%0A%0A%E5%9C%A8READ%20UNCOMMITTED%E5%92%8CREAD%20COMMITTED%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%E4%B8%8B%EF%BC%8C%E4%BD%BF%E7%94%A8%E6%99%AE%E9%80%9A%E7%9A%84%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E5%92%8C%E5%94%AF%E4%B8%80%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E8%BF%9B%E8%A1%8C%E5%8A%A0%E9%94%81%E7%9A%84%E8%BF%87%E7%A8%8B%E6%98%AF%E4%B8%80%E6%A0%B7%E7%9A%84%EF%BC%8C%E6%89%80%E4%BB%A5%E4%B9%9F%E5%B0%B1%E4%B8%8D%E5%88%86%E5%BC%80%E8%AE%A8%E8%AE%BA%E4%BA%86%E3%80%82%0A%0A%23%23%23%23%23%20%E4%BD%BF%E7%94%A8SELECT%20...%20LOCK%20IN%20SHARE%20MODE%E6%9D%A5%E4%B8%BA%E8%AE%B0%E5%BD%95%E5%8A%A0%E9%94%81%0A%E4%BE%8B%EF%BC%9A%0ASELECT%20*%20FROM%20hero%20WHERE%20name%20%3D%20'c%E6%9B%B9%E6%93%8D'%20LOCK%20IN%20SHARE%20MODE%EF%BC%9B%0A%0A%E8%BF%99%E4%B8%AA%E8%AF%AD%E5%8F%A5%E7%9A%84%E6%89%A7%E8%A1%8C%E8%BF%87%E7%A8%8B%E6%98%AF%E5%85%88%E9%80%9A%E8%BF%87%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95idx_name%E5%AE%9A%E4%BD%8D%E5%88%B0%E6%BB%A1%E8%B6%B3name%20%3D%20'c%E6%9B%B9%E6%93%8D'%E6%9D%A1%E4%BB%B6%E7%9A%84%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E8%AE%B0%E5%BD%95%EF%BC%8C%E7%84%B6%E5%90%8E%E8%BF%9B%E8%A1%8C%E5%9B%9E%E8%A1%A8%E6%93%8D%E4%BD%9C%E3%80%82%E6%89%80%E4%BB%A5%E5%85%88%E8%A6%81%E5%AF%B9**%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E8%AE%B0%E5%BD%95%E5%8A%A0S%E5%9E%8BRecord%20Locks**%EF%BC%8C%E7%84%B6%E5%90%8E%E5%86%8D%E7%BB%99**%E5%AF%B9%E5%BA%94%E7%9A%84%E8%81%9A%E7%B0%87%E7%B4%A2%E5%BC%95%E8%AE%B0%E5%BD%95%E5%8A%A0S%E5%9E%8BRecord%20Locks**%EF%BC%8C%E7%A4%BA%E6%84%8F%E5%9B%BE%E5%A6%82%E4%B8%8B%EF%BC%9A%0A!%5B579f140c30b572f0318d91a3f26f91f9.jpeg%5D(en-resource%3A%2F%2Fdatabase%2F1245%3A1)%0A%0A%E8%BF%99%E9%87%8C%E9%9C%80%E8%A6%81%E5%86%8D%E6%AC%A1%E5%BC%BA%E8%B0%83%E4%B8%80%E4%B8%8B%E8%BF%99%E4%B8%AA%E8%AF%AD%E5%8F%A5%E7%9A%84%E5%8A%A0%E9%94%81%E9%A1%BA%E5%BA%8F%EF%BC%9A%0A%0A*%20%E5%85%88%E5%AF%B9name%E5%88%97%E4%B8%BA'c%E6%9B%B9%E6%93%8D'%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E8%AE%B0%E5%BD%95%E8%BF%9B%E8%A1%8C%E5%8A%A0%E9%94%81%E3%80%82%0A*%20%E5%86%8D%E5%AF%B9%E7%9B%B8%E5%BA%94%E7%9A%84%E8%81%9A%E7%B0%87%E7%B4%A2%E5%BC%95%E8%AE%B0%E5%BD%95%E8%BF%9B%E8%A1%8C%E5%8A%A0%E9%94%81%E3%80%82%0A%0A!%5Bc16f4265f478d370d568ae920f730890.png%5D(en-resource%3A%2F%2Fdatabase%2F1247%3A1)%0A%0A%E7%8E%B0%E5%9C%A8%E8%A6%81%E4%BB%8B%E7%BB%8D%E4%B8%80%E4%B8%AA%E9%9D%9E%E5%B8%B8%E6%9C%89%E8%B6%A3%E7%9A%84%E4%BA%8B%E6%83%85%EF%BC%8C%E6%88%91%E4%BB%AC%E5%81%87%E8%AE%BE%E4%B8%8A%E8%BE%B9%E8%BF%99%E4%B8%AA%E8%AF%AD%E5%8F%A5%E5%9C%A8%E4%BA%8B%E5%8A%A1T1%E4%B8%AD%E8%BF%90%E8%A1%8C%EF%BC%8C%E7%84%B6%E5%90%8E%E4%BA%8B%E5%8A%A1T2%E4%B8%AD%E8%BF%90%E8%A1%8C%E4%B8%8B%E8%BE%B9%E4%B8%80%E4%B8%AA%E6%88%91%E4%BB%AC%E4%B9%8B%E5%89%8D%E4%BB%8B%E7%BB%8D%E8%BF%87%E7%9A%84%E8%AF%AD%E5%8F%A5%EF%BC%9A%0AUPDATE%20hero%20SET%20name%20%3D%20'%E6%9B%B9%E6%93%8D'%20WHERE%20number%20%3D%208%EF%BC%9B%0A%0A%E8%BF%99%E4%B8%A4%E4%B8%AA%E8%AF%AD%E5%8F%A5%E9%83%BD%E6%98%AF%E8%A6%81%E5%AF%B9number%E5%80%BC%E4%B8%BA8%E7%9A%84%E8%81%9A%E7%B0%87%E7%B4%A2%E5%BC%95%E8%AE%B0%E5%BD%95%E5%92%8C%E5%AF%B9%E5%BA%94%E7%9A%84%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E8%AE%B0%E5%BD%95%E5%8A%A0%E9%94%81%EF%BC%8C%E4%BD%86%E6%98%AF%E4%B8%8D%E5%90%8C%E7%82%B9%E6%98%AF%E5%8A%A0%E9%94%81%E7%9A%84%E9%A1%BA%E5%BA%8F%E4%B8%8D%E4%B8%80%E6%A0%B7%E3%80%82%E8%BF%99%E4%B8%AAUPDATE%E8%AF%AD%E5%8F%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E9%94%81%E3%80%82%0A%0A%E4%B8%A4%E4%B8%AA%E4%BA%8B%E5%8A%A1%E9%83%BD%E5%88%86%E5%88%AB%E6%8C%81%E6%9C%89%E4%B8%80%E4%B8%AA%E9%94%81%EF%BC%8C%E8%80%8C%E4%B8%94%E9%83%BD%E5%9C%A8%E7%AD%89%E5%BE%85%E5%AF%B9%E6%96%B9%E5%B7%B2%E7%BB%8F%E6%8C%81%E6%9C%89%E7%9A%84%E9%82%A3%E4%B8%AA%E9%94%81%EF%BC%8C%E8%BF%99%E7%A7%8D%E6%83%85%E5%86%B5%E5%B0%B1%E6%98%AF%E6%89%80%E8%B0%93%E7%9A%84%E6%AD%BB%E9%94%81%EF%BC%8C%E4%B8%A4%E4%B8%AA%E4%BA%8B%E5%8A%A1%E9%83%BD%E6%97%A0%E6%B3%95%E8%BF%90%E8%A1%8C%E4%B8%8B%E5%8E%BB%EF%BC%8C%E5%BF%85%E9%A1%BB%E9%80%89%E6%8B%A9%E4%B8%80%E4%B8%AA%E8%BF%9B%E8%A1%8C%E5%9B%9E%E6%BB%9A%EF%BC%8C%E5%AF%B9%E6%80%A7%E8%83%BD%E5%BD%B1%E5%93%8D%E6%AF%94%E8%BE%83%E5%A4%A7%E3%80%82%C2%A0%0A%0A%23%23%23%23%23%20%E4%BD%BF%E7%94%A8SELECT%20...%20FOR%20UPDATE%E6%9D%A5%E4%B8%BA%E8%AE%B0%E5%BD%95%E5%8A%A0%E9%94%81%0A%E4%BE%8B%EF%BC%9A%0ASELECT%20*%20FROM%20hero%20WHERE%20name%20%3D%20'c%E6%9B%B9%E6%93%8D'%20FOR%20UPDATE%EF%BC%9B%0A%0A%E8%BF%99%E7%A7%8D%E6%83%85%E5%86%B5%E4%B8%8B%E4%B8%8ESELECT%20...%20LOCK%20IN%20SHARE%20MODE%E8%AF%AD%E5%8F%A5%E7%9A%84%E5%8A%A0%E9%94%81%E6%83%85%E5%86%B5%E7%B1%BB%E4%BC%BC%EF%BC%8C%E9%83%BD%E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7%9A%84%E5%8A%A0%E9%94%81%E6%83%85%E5%86%B5%E7%B1%BB%E4%BC%BC%EF%BC%8C%E4%B8%8D%E8%BF%87%E5%A6%82%E6%9E%9C%E8%A1%A8%E4%B8%AD%E8%BF%98%E6%9C%89%E5%88%AB%E7%9A%84%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E5%88%97%E7%9A%84%E8%AF%9D%EF%BC%8C%E5%AF%B9%E5%BA%94%E7%9A%84%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E8%AE%B0%E5%BD%95%E4%B9%9F%E4%BC%9A%E8%A2%AB%E5%8A%A0%E9%94%81%E3%80%82%0A%0A%23%23%23%23%202-1-4%20%E4%BD%BF%E7%94%A8%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E8%BF%9B%E8%A1%8C%E8%8C%83%E5%9B%B4%E6%9F%A5%E6%89%BE%0A%0A%23%23%23%23%23%20%E4%BD%BF%E7%94%A8SELECT%20...%20LOCK%20IN%20SHARE%20MODE%E6%9D%A5%E4%B8%BA%E8%AE%B0%E5%BD%95%E5%8A%A0%E9%94%81%0A%0A%E4%BE%8B%EF%BC%9ASELECT%20*%20FROM%20hero%20FORCE%20INDEX(idx_name)%20WHERE%20name%20%3E%3D%20'c%E6%9B%B9%E6%93%8D'%20LOCK%20IN%20SHARE%20MODE%EF%BC%9B%0A!%5B99b02b78a3efdc65ad5b91f2072ebe51.png%5D(en-resource%3A%2F%2Fdatabase%2F1257%3A1)%0A%0A!%5B3d06a2f8dc17726e922d2cf2ab6ecc30.png%5D(en-resource%3A%2F%2Fdatabase%2F1255%3A1)%0A%0A%0A%E8%BF%99%E4%B8%AA%E8%AF%AD%E5%8F%A5%E7%9A%84%E6%89%A7%E8%A1%8C%E8%BF%87%E7%A8%8B%E5%85%B6%E5%AE%9E%E6%98%AF%E5%85%88%E5%88%B0%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E4%B8%AD%E5%AE%9A%E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%E5%86%B5%EF%BC%8C%E5%81%87%E5%A6%82T1%E6%89%A7%E8%A1%8C%E4%BA%86%E4%B8%8A%E8%BF%B0%E8%AF%AD%E5%8F%A5%E5%B9%B6%E4%B8%94%E5%B0%9A%E6%9C%AA%E6%8F%90%E4%BA%A4%EF%BC%8CT2%E5%86%8D%E6%89%A7%E8%A1%8C%E8%BF%99%E4%B8%AA%E8%AF%AD%E5%8F%A5%EF%BC%9A%0ASELECT%20*%20FROM%20hero%20WHERE%20name%20%3D%20'l%E5%88%98%E5%A4%87'%20FOR%20UPDATE%EF%BC%9B%0A%0AT2%E4%B8%AD%E7%9A%84%E8%AF%AD%E5%8F%A5%E9%9C%80%E8%A6%81%E8%8E%B7%E5%8F%96name%E5%80%BC%E4%B8%BAl%E5%88%98%E5%A4%87%E7%9A%84%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E8%AE%B0%E5%BD%95%E4%B8%8A%E7%9A%84X%E5%9E%8BRecord%20Locks%EF%BC%8C%E8%80%8CT1%E4%B8%AD%E4%BB%8D%E7%84%B6%E6%8C%81%E6%9C%89name%E5%80%BC%E4%B8%BAl%E5%88%98%E5%A4%87%E7%9A%84%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E8%AE%B0%E5%BD%95%E4%B8%8A%E7%9A%84S%E5%9E%8BRecord%20Locks%EF%BC%8C%E8%BF%99%E5%B0%B1%E9%80%A0%E6%88%90%E4%BA%86T2%E8%8E%B7%E5%8F%96%E4%B8%8D%E5%88%B0%E9%94%81%E8%80%8C%E8%BF%9B%E5%85%A5%E7%AD%89%E5%BE%85%E7%8A%B6%E6%80%81%E3%80%82%0A!%5B725a6fdb8a224f8279e07d027a757906.png%5D(en-resource%3A%2F%2Fdatabase%2F1253%3A1)%0A%0A%23%23%23%23%23%20%E4%BD%BF%E7%94%A8SELECT%20...%20FOR%20UPDATE%E6%9D%A5%E4%B8%BA%E8%AE%B0%E5%BD%95%E5%8A%A0%E9%94%81%0A%0A%E5%92%8CSELECT%20...%20FOR%20UPDATE%E8%AF%AD%E5%8F%A5%E7%B1%BB%E4%BC%BC%EF%BC%8C%E5%8F%AA%E4%B8%8D%E8%BF%87%E5%8A%A0%E7%9A%84%E6%98%AF**X%E5%9E%8BRecord%20Locks**%E3%80%82%0A%0A%23%23%23%23%23%20%E4%BD%BF%E7%94%A8UPDATE%E6%9D%A5%E4%B8%BA%E8%AE%B0%E5%BD%95%E5%8A%A0%E9%94%81%0A%E4%BE%8B%EF%BC%9A%0AUPDATE%20hero%20SET%20country%20%3D%20'%E6%B1%89'%20WHERE%20name%20%3E%3D%20'c%E6%9B%B9%E6%93%8D'%EF%BC%9B%0A%0A*%20**%E6%B2%A1%E6%9C%89%E7%B4%A2%E5%BC%95%E5%88%97%E8%A2%AB%E6%9B%B4%E6%96%B0**%0A%E5%AE%83%E7%9A%84%E5%8A%A0%E9%94%81%E6%96%B9%E5%BC%8F%E5%92%8C%E4%B8%8A%E8%BE%B9%E6%89%80%E8%AF%B4%E7%9A%84SELECT%20...%20FOR%20UPDATE%E8%AF%AD%E5%8F%A5%E4%B8%80%E8%87%B4%E3%80%82%0A%0A*%20**%E6%9B%B4%E6%96%B0%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95**%0A%E9%82%A3%E4%B9%88%E4%B9%9F%E4%BC%9A%E4%B8%BA%E5%AF%B9%E5%BA%94%E7%9A%84%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E8%AE%B0%E5%BD%95%E8%BF%9B%E8%A1%8C%E5%8A%A0%E9%94%81%EF%BC%9B%0A%0A%0A%E4%B8%8D%E8%BF%87%E8%BF%98%E6%9C%89%E4%B8%80%E4%B8%AA%E6%9C%89%E8%B6%A3%E7%9A%84%E6%83%85%E5%86%B5%EF%BC%8C%E6%AF%94%E6%96%B9%E8%AF%B4%EF%BC%9A%0AUPDATE%20hero%20SET%20country%20%3D%20'%E6%B1%89'%20WHERE%20name%20%3C%3D%20'c%E6%9B%B9%E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%E5%AF%B9%E5%BA%94%E7%9A%84%E8%81%9A%E7%B0%87%E7%B4%A2%E5%BC%95%E8%AE%B0%E5%BD%95%E4%B8%8A%E7%9A%84%E9%94%81%E9%87%8A%E6%94%BE%E6%8E%89%E3%80%82%E8%BF%99%E4%B8%AA%E8%BF%87%E7%A8%8B%E5%A6%82%E4%B8%8B%E5%9B%BE%E6%89%80%E7%A4%BA%EF%BC%9A!%5B9f972fccd65ccb030c0b4ef3a2d22135.jpeg%5D(en-resource%3A%2F%2Fdatabase%2F1259%3A1)%0A%0A%23%23%23%23%23%20%E4%BD%BF%E7%94%A8DELETE%E6%9D%A5%E4%B8%BA%E8%AE%B0%E5%BD%95%E5%8A%A0%E9%94%81%0A!%5Be4fa2788102ec91de141075d2c1d85a7.png%5D(en-resource%3A%2F%2Fdatabase%2F1261%3A1)%0A%0A%23%23%23%23%202-1-5%20%E4%BD%BF%E7%94%A8%E5%85%A8%E8%A1%A8%E6%89%AB%E6%8F%8F%0A%0A%E6%AF%94%E6%96%B9%E8%AF%B4%EF%BC%9A%0ASELECT%20*%20FROM%20hero%20WHERE%20country%20%3D%20'%E9%AD%8F'%20LOCK%20IN%20SHARE%20MODE%EF%BC%9B%0A%0A%0A%E7%94%B1%E4%BA%8Ecountry%E5%88%97%E4%B8%8A%E6%9C%AA%E5%BB%BA%E7%B4%A2%E5%BC%95%EF%BC%8C%E6%89%80%E4%BB%A5%E5%8F%AA%E8%83%BD%E9%87%87%E7%94%A8%E5%85%A8%E8%A1%A8%E6%89%AB%E6%8F%8F%E7%9A%84%E6%96%B9%E5%BC%8F%E6%9D%A5%E6%89%A7%E8%A1%8C%E8%BF%99%E6%9D%A1%E6%9F%A5%E8%AF%A2%E8%AF%AD%E5%8F%A5%EF%BC%8C%E5%AD%98%E5%82%A8%E5%BC%95%E6%93%8E%E6%AF%8F%E8%AF%BB%E5%8F%96%E4%B8%80%E6%9D%A1%E8%81%9A%E7%B0%87%E7%B4%A2%E5%BC%95%E8%AE%B0%E5%BD%95%EF%BC%8C%E5%B0%B1%E4%BC%9A%E4%B8%BA%E8%BF%99%E6%9D%A1%E8%AE%B0%E5%BD%95%E5%8A%A0%E9%94%81%E4%B8%80%E4%B8%AA**S%E5%9E%8BRecord%20Locks**%EF%BC%8C%E7%84%B6%E5%90%8E%E8%BF%94%E5%9B%9E%E7%BB%99server%E5%B1%82%EF%BC%8C%E5%A6%82%E6%9E%9Cserver%E5%B1%82%E5%88%A4%E6%96%ADcountry%20%3D%20'%E9%AD%8F'%E8%BF%99%E4%B8%AA%E6%9D%A1%E4%BB%B6%E6%98%AF%E5%90%A6%E6%88%90%E7%AB%8B%EF%BC%8C%E5%A6%82%E6%9E%9C%E6%88%90%E7%AB%8B%E5%88%99%E5%B0%86%E5%85%B6%E5%8F%91%E9%80%81%E7%BB%99%E5%AE%A2%E6%88%B7%E7%AB%AF%EF%BC%8C%E5%90%A6%E5%88%99%E4%BC%9A%E9%87%8A%E6%94%BE%E6%8E%89%E8%AF%A5%E8%AE%B0%E5%BD%95%E4%B8%8A%E7%9A%84%E9%94%81%EF%BC%8C%E7%94%BB%E4%B8%AA%E5%9B%BE%E5%B0%B1%E5%83%8F%E8%BF%99%E6%A0%B7%EF%BC%9A!%5Bbf99c81b499e9bc95fee6f412695e81d.jpeg%5D(en-resource%3A%2F%2Fdatabase%2F1263%3A1)%0A%0A%E4%BD%BF%E7%94%A8SELECT%20...%20FOR%20UPDATE%E8%BF%9B%E8%A1%8C%E5%8A%A0%E9%94%81%E7%9A%84%E6%83%85%E5%86%B5%E4%B8%8E%E4%B8%8A%E8%BE%B9%E7%B1%BB%E4%BC%BC%EF%BC%8C%E5%8F%AA%E4%B8%8D%E8%BF%87%E5%8A%A0%E7%9A%84%E6%98%AF**X%E5%9E%8BRecord%20Locks**%E3%80%82%0A%0A%E5%AF%B9%E4%BA%8EUPDATE%E5%92%8CDELETE%E7%9A%84%E8%AF%AD%E5%8F%A5%E6%9D%A5%E8%AF%B4%EF%BC%8C%E5%9C%A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5%BA%94%E7%9A%84%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E8%AE%B0%E5%BD%95%E5%8A%A0%E9%94%81%EF%BC%89%E3%80%82%0A%0A%23%23%23%202-2%20Repeatable%20Read%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%0A%0A%E9%87%87%E7%94%A8%E5%8A%A0%E9%94%81%E7%9A%84%E6%96%B9%E5%BC%8F%E8%A7%A3%E5%86%B3%E5%B9%B6%E5%8F%91%E4%BA%8B%E5%8A%A1%E4%BA%A7%E7%94%9F%E7%9A%84%E9%97%AE%E9%A2%98%E6%97%B6%EF%BC%8CREPEATABLE%20READ%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%E4%B8%8EREAD%20UNCOMMITTED%E5%92%8CREAD%20COMMITTED%E8%BF%99%E4%B8%A4%E4%B8%AA%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%E7%9B%B8%E6%AF%94%EF%BC%8C%E6%9C%80%E4%B8%BB%E8%A6%81%E7%9A%84%E5%B0%B1%E6%98%AF%E8%A6%81%E8%A7%A3%E5%86%B3%E5%B9%BB%E8%AF%BB%E9%97%AE%E9%A2%98%EF%BC%8C%E5%B9%BB%E8%AF%BB%E9%97%AE%E9%A2%98%E7%9A%84%E8%A7%A3%E5%86%B3%E8%BF%98%E5%BE%97%E9%9D%A0%E6%88%91%E4%BB%AC%E4%B9%8B%E5%89%8D%E8%AE%B2%E8%BF%87%E7%9A%84**gap%E9%94%81**%E3%80%82%0A%0A%E4%BD%86%E6%98%AF%E9%9C%80%E8%A6%81%E6%B3%A8%E6%84%8F%E7%9A%84%E6%98%AF**Gap%E9%94%81%E5%8F%AA%E5%AF%B9INSERT%E8%AF%AD%E5%8F%A5%E7%94%9F%E6%95%88%E3%80%82**%0A%0A%23%23%23%202-2-1%20%E4%BD%BF%E7%94%A8%E4%B8%BB%E9%94%AE%E8%BF%9B%E8%A1%8C%E7%AD%89%E5%80%BC%E6%9F%A5%E8%AF%A2%0A%0A%23%23%23%23%20%E4%BD%BF%E7%94%A8SELECT%20.%20.%20.%20LOCK%20IN%20SHARE%20MODE%E6%9D%A5%E4%B8%BA%E8%AE%B0%E5%BD%95%E5%8A%A0%E9%94%81%0A%0A%0A*%20**%E6%9F%A5%E8%AF%A2%E4%B8%BB%E9%94%AE%E5%80%BC%E5%AD%98%E5%9C%A8%E7%9B%B8%E5%BA%94%E7%9A%84%E8%AE%B0%E5%BD%95**%0A%E4%BE%8B%EF%BC%9A%0ASELECT%20*%20FROM%20hero%20WHERE%20number%20%3D%208%20LOCK%20IN%20SHARE%20MODE%EF%BC%9B%0A%E8%BF%99%E7%A7%8D%E6%83%85%E5%86%B5%E4%B8%8B%E5%92%8CREAD%20UNCOMMITTED%EF%BC%8FREAD%20COMMITTED%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%E4%B8%8B%E4%B8%80%E6%A0%B7%EF%BC%8C%E5%8F%AA%E9%9C%80%E8%A6%81%E4%B8%BA%E8%BF%99%E6%9D%A1number%E5%80%BC%E4%B8%BA8%E7%9A%84%E8%AE%B0%E5%BD%95%E5%8A%A0%E4%B8%80%E4%B8%AA**S%E5%9E%8BRecord%20Locks**%E5%B0%B1%E5%A5%BD%E4%BA%86%EF%BC%8C%E5%A6%82%E5%9B%BE%E6%89%80%E7%A4%BA%EF%BC%9A%0A!%5B80b73b1d5fd3ef4eca9ccfb727630961.jpeg%5D(en-resource%3A%2F%2Fdatabase%2F1223%3A1)%0A%0A*%20**%E6%9F%A5%E8%AF%A2%E4%B8%BB%E9%94%AE%E5%80%BC%E4%B8%8D%E5%AD%98%E5%9C%A8%E7%9B%B8%E5%BA%94%E7%9A%84%E8%AE%B0%E5%BD%95**%0A%E4%BE%8B%EF%BC%9A%0ASELECT%20*%20FROM%20hero%20WHERE%20number%20%3D%207%20LOCK%20IN%20SHARE%20MODE%EF%BC%9B%0A%E7%94%B1%E4%BA%8Enumber%E5%80%BC%E4%B8%BA7%E7%9A%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4%B8%AA%E5%9B%BE%E8%A1%A8%E7%A4%BA%E4%B8%80%E4%B8%8B%EF%BC%9A!%5B20858b2fb168231b10da222aa0d011cb.jpeg%5D(en-resource%3A%2F%2Fdatabase%2F1265%3A0)%0A%0A%23%23%23%23%20%E4%BD%BF%E7%94%A8SELECT%20.%20.%20.%20FOR%20UPDATE%E6%9D%A5%E4%B8%BA%E8%AE%B0%E5%BD%95%E5%8A%A0%E9%94%81%0A%E4%B8%8ESELECT%20.%20.%20.%20LOCK%20IN%20SHARE%20MODE%E7%B1%BB%E4%BC%BC%EF%BC%8C%E5%8F%AA%E4%B8%8D%E8%BF%87%E5%8A%A0%E7%9A%84%E6%98%AF**X%E5%9E%8BRecord%20Locks**%0A%23%23%23%23%20%E4%BD%BF%E7%94%A8UPDATE%E6%9D%A5%E4%B8%BA%E8%AE%B0%E5%BD%95%E5%8A%A0%E9%94%81%0A%E4%B8%8ESELECT%20.%20.%20.%20FOR%20UPDATE%E7%B1%BB%E4%BC%BC%EF%BC%8C%E5%8F%AA%E4%B8%8D%E8%BF%87%E5%8A%A0%E7%9A%84%E6%98%AF**X%E5%9E%8BRecord%20Locks**%EF%BC%8C%E5%AF%B9%E4%BA%8E%E6%9B%B4%E6%96%B0%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E7%9A%84%E6%83%85%E5%86%B5%EF%BC%8C%E5%92%8CREAD%20UNCOMMITTED%EF%BC%8FREAD%20COMMITTED%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%E4%B8%8B%E7%9A%84%E6%83%85%E5%86%B5%E7%B1%BB%E4%BC%BC%E3%80%82%0A%0A%23%23%23%23%20%E4%BD%BF%E7%94%A8DELETE%E6%9D%A5%E4%B8%BA%E8%AE%B0%E5%BD%95%E5%8A%A0%E9%94%81%0A%E4%B8%8ESELECT%20.%20.%20.%20FOR%20UPDATE%E7%B1%BB%E4%BC%BC%EF%BC%8C%E5%8F%AA%E4%B8%8D%E8%BF%87%E5%8A%A0%E7%9A%84%E6%98%AF**X%E5%9E%8BRecord%20Locks**%EF%BC%8C%E5%AF%B9%E4%BA%8E%E6%9B%B4%E6%96%B0%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E7%9A%84%E6%83%85%E5%86%B5%EF%BC%8C%E5%92%8CREAD%20UNCOMMITTED%EF%BC%8FREAD%20COMMITTED%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%E4%B8%8B%E7%9A%84%E6%83%85%E5%86%B5%E7%B1%BB%E4%BC%BC%E3%80%82%0A%0A%23%23%23%202-2-2%20%E4%BD%BF%E7%94%A8%E4%B8%BB%E9%94%AE%E8%BF%9B%E8%A1%8C%E8%8C%83%E5%9B%B4%E6%9F%A5%E8%AF%A2%0A%0A%23%23%23%23%20%E4%BD%BF%E7%94%A8SELECT%20...%20LOCK%20IN%20SHARE%20MODE%E6%9D%A5%E4%B8%BA%E8%AE%B0%E5%BD%95%E5%8A%A0%E9%94%81%0A%E4%BE%8B%EF%BC%9A%0ASELECT%20*%20FROM%20hero%20WHERE%20number%20%3E%3D%208%20LOCK%20IN%20SHARE%20MODE%EF%BC%9B%0A%0A*%20%E4%B8%BAnumber%E5%80%BC%E4%B8%BA8%E7%9A%84%E8%81%9A%E7%B0%87%E7%B4%A2%E5%BC%95%E8%AE%B0%E5%BD%95%E5%8A%A0%E4%B8%80%E4%B8%AA**S%E5%9E%8BRecord%20Locks**%E3%80%82%0A*%20%E4%B8%BAnumber%E5%80%BC%E5%A4%A7%E4%BA%8E8%E7%9A%84%E6%89%80%E6%9C%89%E8%81%9A%E7%B0%87%E7%B4%A2%E5%BC%95%E8%AE%B0%E5%BD%95%E9%83%BD%E5%8A%A0%E4%B8%80%E4%B8%AA**S%E5%9E%8Bnext-key%E9%94%81**%EF%BC%88%E5%8C%85%E6%8B%ACSupremum%E4%BC%AA%E8%AE%B0%E5%BD%95%EF%BC%89%E3%80%82%0A!%5Bcc34587cd972096925451f8ccfba8db7.jpeg%5D(en-resource%3A%2F%2Fdatabase%2F1268%3A0)%0A%0A%0A%E4%B8%8EREAD%20UNCOMMITTED%2FREAD%20COMMITTED%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%E7%B1%BB%E4%BC%BC%EF%BC%8C%E5%9C%A8REPEATABLE%20READ%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%E4%B8%8B%EF%BC%8C%E4%B8%8B%E8%BE%B9%E8%BF%99%E4%B8%AA%E8%8C%83%E5%9B%B4%E6%9F%A5%E8%AF%A2%E4%B9%9F%E6%98%AF%E6%9C%89%E7%82%B9%E7%89%B9%E6%AE%8A%EF%BC%9A%0ASELECT%20*%20FROM%20hero%20WHERE%20number%20%3C%3D%208%20LOCK%20IN%20SHARE%20MODE%EF%BC%9B%0A%0A%E5%9C%A8READ%20UNCOMMITTED%2FREAD%20COMMITTED%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%E4%B8%8B%EF%BC%8C%E8%BF%99%E4%B8%AA%E8%AF%AD%E5%8F%A5%E4%BC%9A%E4%B8%BAnumber%E5%80%BC%E4%B8%BA1%E3%80%813%E3%80%818%E3%80%8115%E8%BF%994%E6%9D%A1%E8%AE%B0%E5%BD%95%E9%83%BD%E5%8A%A0%E4%B8%8AS%E5%9E%8B%E6%AD%A3%E7%BB%8F%E8%AE%B0%E5%BD%95%E9%94%81%EF%BC%8C%E7%84%B6%E5%90%8E%E7%94%B1%E4%BA%8Enumber%E5%80%BC%E4%B8%BA15%E7%9A%84%E8%AE%B0%E5%BD%95%E4%B8%8D%E6%BB%A1%E8%B6%B3%E8%BE%B9%E7%95%8C%E6%9D%A1%E4%BB%B6number%20%3C%3D%208%EF%BC%8C%E9%9A%8F%E5%90%8E%E4%BE%BF%E6%8A%8A%E8%BF%99%E6%9D%A1%E8%AE%B0%E5%BD%95%E7%9A%84%E9%94%81%E9%87%8A%E6%94%BE%E6%8E%89%E3%80%82%0A%0A%E5%9C%A8REPEATABLE%20READ%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%E4%B8%8B%E7%9A%84%E5%8A%A0%E9%94%81%E8%BF%87%E7%A8%8B%E4%B8%8E%E4%B9%8B%E7%B1%BB%E4%BC%BC%EF%BC%8C%E4%B8%8D%E8%BF%87%E4%BC%9A%E4%B8%BA1%E3%80%813%E3%80%818%E3%80%8115%E8%BF%994%E6%9D%A1%E8%AE%B0%E5%BD%95%E9%83%BD%E5%8A%A0%E4%B8%8A**S%E5%9E%8Bnext-key%E9%94%81**%EF%BC%8C**%E4%BD%86%E6%98%AF%E6%9C%89%E4%B8%80%E7%82%B9%E9%9C%80%E8%A6%81%E5%A4%A7%E5%AE%B6%E5%8D%81%E5%88%86%E6%B3%A8%E6%84%8F%EF%BC%9AREPEATABLE%20READ%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%E4%B8%8B%EF%BC%8C%E5%9C%A8%E5%88%A4%E6%96%ADnumber%E5%80%BC%E4%B8%BA15%E7%9A%84%E8%AE%B0%E5%BD%95%E4%B8%8D%E6%BB%A1%E8%B6%B3%E8%BE%B9%E7%95%8C%E6%9D%A1%E4%BB%B6%20number%20%3C%3D%208%20%E5%90%8E%EF%BC%8C%E5%B9%B6%E4%B8%8D%E4%BC%9A%E5%8E%BB%E9%87%8A%E6%94%BE%E5%8A%A0%E5%9C%A8%E8%AF%A5%E8%AE%B0%E5%BD%95%E4%B8%8A%E7%9A%84%E9%94%81%EF%BC%81%EF%BC%81%EF%BC%81%C2%A0%E6%89%80%E4%BB%A5%E5%9C%A8REPEATABLE%20READ%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%E4%B8%8B%EF%BC%8C%E8%AF%A5%E8%AF%AD%E5%8F%A5%E7%9A%84%E5%8A%A0%E9%94%81%E7%A4%BA%E6%84%8F%E5%9B%BE%E5%B0%B1%E5%A6%82%E4%B8%8B%E6%89%80%E7%A4%BA%EF%BC%9A**%0A!%5B04b5c058b899a574855e09ac7b289260.jpeg%5D(en-resource%3A%2F%2Fdatabase%2F1267%3A0)%0A%0A%E8%BF%99%E6%A0%B7%E5%A6%82%E6%9E%9C%E5%88%AB%E7%9A%84%E4%BA%8B%E5%8A%A1%E6%83%B3%E8%A6%81%E6%8F%92%E5%85%A5%E7%9A%84%E6%96%B0%E8%AE%B0%E5%BD%95%E7%9A%84number%E5%80%BC%E5%9C%A8(-%E2%88%9E%2C%201)%E3%80%81(1%2C%203)%E3%80%81(3%2C%208)%E3%80%81(8%2C%2015)%E4%B9%8B%E9%97%B4%E7%9A%84%E8%AF%9D%EF%BC%8C%E6%98%AF%E4%BC%9A%E8%BF%9B%E5%85%A5%E7%AD%89%E5%BE%85%E7%8A%B6%E6%80%81%E7%9A%84%E3%80%82!%5B4a023212491ef472f346e6ca2a7be69e.png%5D(en-resource%3A%2F%2Fdatabase%2F1269%3A0)%0A%0A%23%23%23%23%20%E4%BD%BF%E7%94%A8SELECT%20.%20.%20.%20FOR%20UPDATE%E6%9D%A5%E4%B8%BA%E8%AE%B0%E5%BD%95%E5%8A%A0%E9%94%81%0A%0A%E5%92%8CSELECT%20...%20LOCK%20IN%20SHARE%20MODE%E8%AF%AD%E5%8F%A5%E7%B1%BB%E4%BC%BC%EF%BC%8C%E5%8F%AA%E4%B8%8D%E8%BF%87%E9%9C%80%E8%A6%81%E5%B0%86%E4%B8%8A%E8%BE%B9%E6%8F%90%E5%88%B0%E7%9A%84S%E5%9E%8Bnext-key%E9%94%81%E6%9B%BF%E6%8D%A2%E6%88%90**X%E5%9E%8Bnext-key%E9%94%81**%E3%80%82%0A%0A%23%23%23%23%20%E4%BD%BF%E7%94%A8UPDATE%E6%9D%A5%E4%B8%BA%E8%AE%B0%E5%BD%95%E5%8A%A0%E9%94%81%0A%0A*%20**%E6%9C%AA%E6%9B%B4%E6%96%B0%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E5%88%97**%0A%E5%8A%A0%E9%94%81%E6%96%B9%E5%BC%8F%E5%92%8C%E4%B8%8A%E8%BE%B9%E6%89%80%E8%AF%B4%E7%9A%84SELECT%20...%20FOR%20UPDATE%E8%AF%AD%E5%8F%A5%E4%B8%80%E8%87%B4%E3%80%82%0A%0A*%20**%E6%9B%B4%E6%96%B0%E4%BA%86%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E5%88%97**%0A%E4%BE%8B%EF%BC%9AUPDATE%20hero%20SET%20name%20%3D%20'cao%E6%9B%B9%E6%93%8D'%20WHERE%20number%20%3E%3D%208%EF%BC%9B%0A%E5%AF%B9%E8%81%9A%E7%B0%87%E7%B4%A2%E5%BC%95%E8%AE%B0%E5%BD%95%E5%8A%A0%E9%94%81%E7%9A%84%E6%83%85%E5%86%B5%E5%92%8CSELECT%20...%20FOR%20UPDATE%E8%AF%AD%E5%8F%A5%E4%B8%80%E8%87%B4%EF%BC%8C%E4%B9%9F%E5%B0%B1%E6%98%AF%E5%AF%B9number%E5%80%BC%E4%B8%BA8%E7%9A%84%E8%81%9A%E7%B0%87%E7%B4%A2%E5%BC%95%E8%AE%B0%E5%BD%95%E5%8A%A0X%E5%9E%8B%E6%AD%A3%E7%BB%8F%E8%AE%B0%E5%BD%95%E9%94%81%EF%BC%8C%E5%AF%B9number%E5%80%BC15%E3%80%8120%E7%9A%84%E8%81%9A%E7%B0%87%E7%B4%A2%E5%BC%95%E8%AE%B0%E5%BD%95%E4%BB%A5%E5%8F%8ASupremum%E8%AE%B0%E5%BD%95%E5%8A%A0X%E5%9E%8Bnext-key%E9%94%81%E3%80%82%E4%BD%86%E6%98%AF%E5%9B%A0%E4%B8%BA%E4%B9%9F%E8%A6%81%E6%9B%B4%E6%96%B0%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95idx_name%EF%BC%8C%E6%89%80%E4%BB%A5%E4%B9%9F%E4%BC%9A%E5%AF%B9number%E5%80%BC%E4%B8%BA8%E3%80%8115%E3%80%8120%E7%9A%84%E8%81%9A%E7%B0%87%E7%B4%A2%E5%BC%95%E8%AE%B0%E5%BD%95%E5%AF%B9%E5%BA%94%E7%9A%84idx_name%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E8%AE%B0%E5%BD%95%E5%8A%A0X%E5%9E%8B%E6%AD%A3%E7%BB%8F%E8%AE%B0%E5%BD%95%E9%94%81%EF%BC%8C%E7%94%BB%E4%B8%AA%E5%9B%BE%E8%A1%A8%E7%A4%BA%E4%B8%80%E4%B8%8B%EF%BC%9A%0A!%5B221bebf974264f9c2cc80c1f59e2dee2.jpeg%5D(en-resource%3A%2F%2Fdatabase%2F1270%3A0)%0A%0A%E5%A6%82%E6%9E%9C%E6%98%AF%E4%B8%8B%E8%BE%B9%E8%BF%99%E4%B8%AA%E8%AF%AD%E5%8F%A5%EF%BC%9AUPDATE%20hero%20SET%20name%20%3D%20'cao%E6%9B%B9%E6%93%8D'%20WHERE%20number%20%3C%3D%208%EF%BC%9B%0A%E5%88%99%E4%BC%9A%E5%AF%B9number%E5%80%BC%E4%B8%BA1%E3%80%813%E3%80%818%E3%80%8115%E7%9A%84%E8%81%9A%E7%B0%87%E7%B4%A2%E5%BC%95%E8%AE%B0%E5%BD%95%E5%8A%A0X%E5%9E%8Bnext-key%EF%BC%8C%E5%85%B6%E4%B8%ADnumber%E5%80%BC%E4%B8%BA15%E7%9A%84%E8%81%9A%E7%B0%87%E7%B4%A2%E5%BC%95%E8%AE%B0%E5%BD%95%E4%B8%8D%E6%BB%A1%E8%B6%B3number%20%3C%3D%208%E7%9A%84%E8%BE%B9%E7%95%8C%E6%9D%A1%E4%BB%B6%EF%BC%8C%E8%99%BD%E7%84%B6%E5%9C%A8REPEATABLE%20READ%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%E4%B8%8B%E4%B8%8D%E4%BC%9A%E5%B0%86%E5%AE%83%E7%9A%84%E9%94%81%E9%87%8A%E6%94%BE%E6%8E%89%EF%BC%8C%E4%BD%86%E6%98%AF%E4%B9%9F%E5%B9%B6%E4%B8%8D%E4%BC%9A%E5%AF%B9%E8%BF%99%E6%9D%A1%E8%81%9A%E7%B0%87%E7%B4%A2%E5%BC%95%E8%AE%B0%E5%BD%95%E5%AF%B9%E5%BA%94%E7%9A%84%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E8%AE%B0%E5%BD%95%E5%8A%A0%E9%94%81%EF%BC%8C%E4%B9%9F%E5%B0%B1%E6%98%AF%E8%AF%B4%E5%8F%AA%E4%BC%9A%E4%B8%BAnumber%E5%80%BC%E4%B8%BA1%E3%80%813%E3%80%818%E7%9A%84%E8%81%9A%E7%B0%87%E7%B4%A2%E5%BC%95%E8%AE%B0%E5%BD%95%E5%AF%B9%E5%BA%94%E7%9A%84idx_name%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E8%AE%B0%E5%BD%95%E5%8A%A0X%E5%9E%8B%E6%AD%A3%E7%BB%8F%E8%AE%B0%E5%BD%95%E9%94%81%EF%BC%8C%E5%8A%A0%E9%94%81%E7%A4%BA%E6%84%8F%E5%9B%BE%E5%A6%82%E4%B8%8B%E6%89%80%E7%A4%BA%EF%BC%9A!%5B39a220ee6258aa2b21cce734da33d5a7.jpeg%5D(en-resource%3A%2F%2Fdatabase%2F1271%3A0)%0A%0A%0A%23%23%23%23%20%E4%BD%BF%E7%94%A8DELETE%E6%9D%A5%E4%B8%BA%E8%AE%B0%E5%BD%95%E5%8A%A0%E9%94%81%0A%E8%BF%99%E4%B8%A4%E4%B8%AA%E8%AF%AD%E5%8F%A5%E7%9A%84%E5%8A%A0%E9%94%81%E6%83%85%E5%86%B5%E5%92%8C%E6%9B%B4%E6%96%B0%E5%B8%A6%E6%9C%89%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E5%88%97%E7%9A%84UPDATE%E8%AF%AD%E5%8F%A5%E4%B8%80%E8%87%B4%EF%BC%8C%E5%B0%B1%E4%B8%8D%E7%94%BB%E5%9B%BE%E4%BA%86%E3%80%82%0A%0A%23%23%23%202-2-3%20%E4%BD%BF%E7%94%A8%E5%94%AF%E4%B8%80%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E8%BF%9B%E8%A1%8C%E7%AD%89%E5%80%BC%E6%9F%A5%E8%AF%A2%0A%0A%E7%94%B1%E4%BA%8Ehero%E8%A1%A8%E5%B9%B6%E6%B2%A1%E6%9C%89%E5%94%AF%E4%B8%80%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%EF%BC%8C%E6%88%91%E4%BB%AC%E6%8A%8A%E5%8E%9F%E5%85%88%E7%9A%84idx_name%E4%BF%AE%E6%94%B9%E4%B8%BA%E4%B8%80%E4%B8%AA%E5%94%AF%E4%B8%80%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95uk_name%EF%BC%9A%0A%0AALTER%20TABLE%20hero%20DROP%20INDEX%20idx_name%2C%20ADD%20UNIQUE%20KEY%20uk_name%20(name)%3B%0A%0A%23%23%23%23%20%E4%BD%BF%E7%94%A8SELECT%20...%20LOCK%20IN%20SHARE%20MODE%E8%AF%AD%E5%8F%A5%E6%9D%A5%E4%B8%BA%E8%AE%B0%E5%BD%95%E5%8A%A0%E9%94%81%0A%E4%BE%8B%EF%BC%9A%0ASELECT%20*%20FROM%20hero%20WHERE%20name%20%3D%20'c%E6%9B%B9%E6%93%8D'%20LOCK%20IN%20SHARE%20MODE%EF%BC%9B%0A%0A%E7%94%B1%E4%BA%8E%E5%94%AF%E4%B8%80%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E5%85%B7%E6%9C%89%E5%94%AF%E4%B8%80%E6%80%A7%EF%BC%8C%E5%A6%82%E6%9E%9C%E5%9C%A8%E4%B8%80%E4%B8%AA%E4%BA%8B%E5%8A%A1%E4%B8%AD%E7%AC%AC%E4%B8%80%E6%AC%A1%E6%89%A7%E8%A1%8C%E4%B8%8A%E8%BF%B0%E8%AF%AD%E5%8F%A5%E6%97%B6%E5%B0%86%E5%BE%97%E5%88%B0%E4%B8%80%E6%9D%A1%E8%AE%B0%E5%BD%95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%9A%84%E8%81%9A%E7%B0%87%E7%B4%A2%E5%BC%95%E8%AE%B0%E5%BD%95%E5%8A%A0%E4%B8%80%E4%B8%AAS%E5%9E%8B%E6%AD%A3%E7%BB%8F%E8%AE%B0%E5%BD%95%E9%94%81%E5%B0%B1%E5%A5%BD%E4%BA%86%EF%BC%8C%E6%88%91%E4%BB%AC%E7%94%BB%E4%B8%AA%E5%9B%BE%E7%9C%8B%E7%9C%8B%EF%BC%9A%0A!%5Baafceee7ab592207e886e71495eaa1f7.jpeg%5D(en-resource%3A%2F%2Fdatabase%2F1273%3A0)%0A%0A%0A%E5%A6%82%E6%9E%9C%E5%AF%B9%E5%94%AF%E4%B8%80%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E5%88%97%E8%BF%9B%E8%A1%8C%E7%AD%89%E5%80%BC%E6%9F%A5%E8%AF%A2%E7%9A%84%E8%AE%B0%E5%BD%95%E5%B9%B6%E4%B8%8D%E5%AD%98%E5%9C%A8%EF%BC%8C%E6%AF%94%E5%A6%82%EF%BC%9A%0ASELECT%20*%20FROM%20hero%20WHERE%20name%20%3D%20'g%E5%85%B3%E7%BE%BD'%20LOCK%20IN%20SHARE%20MODE%EF%BC%9B%0A%0A%E4%B8%BA%E4%BA%86%E7%A6%81%E6%AD%A2%E5%B9%BB%E8%AF%BB%EF%BC%8C%E6%89%80%E4%BB%A5%E9%9C%80%E8%A6%81%E4%BF%9D%E8%AF%81%E5%88%AB%E7%9A%84%E4%BA%8B%E5%8A%A1%E4%B8%8D%E8%83%BD%E5%86%8D%E6%8F%92%E5%85%A5name%E5%80%BC%E4%B8%BA'g%E5%85%B3%E7%BE%BD'%E7%9A%84%E6%96%B0%E8%AE%B0%E5%BD%95%E3%80%82%E5%9C%A8%E5%94%AF%E4%B8%80%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95uk_name%E4%B8%AD%EF%BC%8C%E9%94%AE%E5%80%BC%E6%AF%94'g%E5%85%B3%E7%BE%BD'%E5%A4%A7%E7%9A%84%E7%AC%AC%E4%B8%80%E6%9D%A1%E8%AE%B0%E5%BD%95%E7%9A%84%E9%94%AE%E5%80%BC%E4%B8%BAl%E5%88%98%E5%A4%87%EF%BC%8C%E6%89%80%E4%BB%A5%E9%9C%80%E8%A6%81%E5%9C%A8%E8%BF%99%E6%9D%A1%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E8%AE%B0%E5%BD%95%E4%B8%8A%E5%8A%A0%E4%B8%80%E4%B8%AA**gap%E9%94%81**%EF%BC%8C%E5%A6%82%E5%9B%BE%E6%89%80%E7%A4%BA%EF%BC%9A!%5B62e30c0149b2a37a621342919586cba5.jpeg%5D(en-resource%3A%2F%2Fdatabase%2F1272%3A0)%0A%0A%E6%B3%A8%E6%84%8F%EF%BC%8C**%E8%BF%99%E9%87%8C%E5%8F%AA%E5%AF%B9%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E8%AE%B0%E5%BD%95%E8%BF%9B%E8%A1%8C%E5%8A%A0%E9%94%81%EF%BC%8C%E5%B9%B6%E4%B8%8D%E4%BC%9A%E5%AF%B9%E8%81%9A%E7%B0%87%E7%B4%A2%E5%BC%95%E8%AE%B0%E5%BD%95%E8%BF%9B%E8%A1%8C%E5%8A%A0%E9%94%81%E3%80%82**%0A%0A%23%23%23%23%20%E4%BD%BF%E7%94%A8SELECT%20...%20FOR%20UPDATE%E8%AF%AD%E5%8F%A5%E6%9D%A5%E4%B8%BA%E8%AE%B0%E5%BD%95%E5%8A%A0%E9%94%81%0A%0A%E5%92%8CSELECT%20...%20LOCK%20IN%20SHARE%20MODE%E8%AF%AD%E5%8F%A5%E7%B1%BB%E4%BC%BC%EF%BC%8C%E5%8F%AA%E4%B8%8D%E8%BF%87%E5%8A%A0%E7%9A%84%E6%98%AF**X%E5%9E%8BRecord%20Locks**%E3%80%82%0A%0A%23%23%23%23%20%E4%BD%BF%E7%94%A8UPDATE%E8%AF%AD%E5%8F%A5%E6%9D%A5%E4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%0A%0A%23%23%23%202-2-4%20%E4%BD%BF%E7%94%A8%E5%94%AF%E4%B8%80%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E8%BF%9B%E8%A1%8C%E8%8C%83%E5%9B%B4%E6%9F%A5%E8%AF%A2%0A%0A%23%23%23%23%20%E4%BD%BF%E7%94%A8SELECT%20...%20LOCK%20IN%20SHARE%20MODE%E8%AF%AD%E5%8F%A5%E6%9D%A5%E4%B8%BA%E8%AE%B0%E5%BD%95%E5%8A%A0%E9%94%81%0A%E4%BE%8B%EF%BC%9A%0ASELECT%20*%20FROM%20hero%20FORCE%20INDEX(uk_name)%20WHERE%20name%20%3E%3D%20'c%E6%9B%B9%E6%93%8D'%20LOCK%20IN%20SHARE%20MODE%EF%BC%9B%0A%0A%E8%BF%99%E4%B8%AA%E8%AF%AD%E5%8F%A5%E7%9A%84%E6%89%A7%E8%A1%8C%E8%BF%87%E7%A8%8B%E5%85%B6%E5%AE%9E%E6%98%AF%E5%85%88%E5%88%B0%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E4%B8%AD%E5%AE%9A%E4%BD%8D%E5%88%B0%E6%BB%A1%E8%B6%B3name%20%3E%3D%20'c%E6%9B%B9%E6%93%8D'%E7%9A%84%E7%AC%AC%E4%B8%80%E6%9D%A1%E8%AE%B0%E5%BD%95%EF%BC%8C%E4%B9%9F%E5%B0%B1%E6%98%AFname%E5%80%BC%E4%B8%BAc%E6%9B%B9%E6%93%8D%E7%9A%84%E8%AE%B0%E5%BD%95%EF%BC%8C%E7%84%B6%E5%90%8E%E5%B0%B1%E5%8F%AF%E4%BB%A5%E6%B2%BF%E7%9D%80%E7%94%B1%E8%AE%B0%E5%BD%95%E7%BB%84%E6%88%90%E7%9A%84%E5%8D%95%E5%90%91%E9%93%BE%E8%A1%A8%E4%B8%80%E8%B7%AF%E5%90%91%E5%90%8E%E6%89%BE%E3%80%82%E4%BB%8E%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%B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BA%94%E7%9A%84%E8%81%9A%E7%B0%87%E7%B4%A2%E5%BC%95%E8%AE%B0%E5%BD%95%E5%8A%A0%E9%94%81%EF%BC%8C%E5%AE%8C%E5%90%8E%E6%89%8D%E4%BC%9A%E5%AF%B9%E4%B8%8B%E4%B8%80%E6%9D%A1%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E8%AE%B0%E5%BD%95%E8%BF%9B%E8%A1%8C%E5%8A%A0%E9%94%81%EF%BC%8C%E4%BB%A5%E6%AD%A4%E7%B1%BB%E6%8E%A8%EF%BD%9E%20%E7%94%BB%E4%B8%AA%E5%9B%BE%E8%A1%A8%E7%A4%BA%E4%B8%80%E4%B8%8B%E5%B0%B1%E6%98%AF%E8%BF%99%E6%A0%B7%EF%BC%9A!%5B7cf2f4d4765608f0fe6de68c050e91df.jpeg%5D(en-resource%3A%2F%2Fdatabase%2F1274%3A0)%0A%0A%0A%E4%BE%8B%EF%BC%9A%0ASELECT%20*%20FROM%20hero%20WHERE%20name%20%3C%3D%20'c%E6%9B%B9%E6%93%8D'%20LOCK%20IN%20SHARE%20MODE%EF%BC%9B%0A%0A%E8%BF%99%E4%B8%AA%E8%AF%AD%E5%8F%A5%E5%85%88%E4%BC%9A%E4%B8%BAname%E5%80%BC%E4%B8%BA'c%E6%9B%B9%E6%93%8D'%E7%9A%84%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E8%AE%B0%E5%BD%95%E5%8A%A0S%E5%9E%8Bnext-key%E9%94%81%E4%BB%A5%E5%8F%8A%E5%AE%83%E5%AF%B9%E5%BA%94%E7%9A%84%E8%81%9A%E7%B0%87%E7%B4%A2%E5%BC%95%E8%AE%B0%E5%BD%95%E5%8A%A0S%E5%9E%8B%E6%AD%A3%E7%BB%8F%E8%AE%B0%E5%BD%95%E9%94%81%E3%80%82%E7%84%B6%E5%90%8E%E8%BF%98%E8%A6%81%E7%BB%99name%E5%80%BC%E4%B8%BA'l%E5%88%98%E5%A4%87'%E7%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F%2Fdatabase%2F1275%3A0)%0A%0A%E8%BF%99%E9%87%8C%E5%A4%A7%E5%AE%B6%E8%A6%81%E6%B3%A8%E6%84%8F%E4%B8%80%E4%B8%8B%EF%BC%8C**InnoDB%E5%9C%A8%E8%BF%99%E9%87%8C%E7%BB%99name%E5%80%BC%E4%B8%BA'l%E5%88%98%E5%A4%87'%E7%9A%84%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E8%AE%B0%E5%BD%95%E5%8A%A0%E7%9A%84%E6%98%AFS%E5%9E%8Bnext-key%E9%94%81%EF%BC%8C%E8%80%8C%E4%B8%8D%E6%98%AF%E7%AE%80%E5%8D%95%E7%9A%84gap%E9%94%81**%E3%80%82%0A%0A%23%23%23%23%20%E4%BD%BF%E7%94%A8SELECT%20...%20FOR%20UPDATE%E8%AF%AD%E5%8F%A5%E6%9D%A5%E4%B8%BA%E8%AE%B0%E5%BD%95%E5%8A%A0%E9%94%81%0A%0A%E5%92%8CSELECT%20...%20LOCK%20IN%20SHARE%20MODE%E8%AF%AD%E5%8F%A5%E7%B1%BB%E4%BC%BC%EF%BC%8C%E5%8F%AA%E4%B8%8D%E8%BF%87%E5%8A%A0%E7%9A%84%E6%98%AF**X%E5%9E%8B%E9%94%81**%E3%80%82%0A%0A%23%23%23%23%20%E4%BD%BF%E7%94%A8UPDATE%E8%AF%AD%E5%8F%A5%E6%9D%A5%E4%B8%BA%E8%AE%B0%E5%BD%95%E5%8A%A0%E9%94%81%0A%E4%BE%8B%EF%BC%9A%0AUPDATE%20hero%20SET%20country%20%3D%20'%E6%B1%89'%20WHERE%20name%20%3E%3D%20'c%E6%9B%B9%E6%93%8D'%EF%BC%9B%0A%E5%81%87%E8%AE%BE%E8%AF%A5%E8%AF%AD%E5%8F%A5%E6%89%A7%E8%A1%8C%E6%97%B6%E4%BD%BF%E7%94%A8%E4%BA%86uk_name%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E6%9D%A5%E8%BF%9B%E8%A1%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%E4%BB%AC%E5%AF%B9%E5%BA%94%E7%9A%84%E8%81%9A%E7%B0%87%E7%B4%A2%E5%BC%95%E8%AE%B0%E5%BD%95%E8%BF%9B%E8%A1%8C%E5%8A%A0X%E5%9E%8B%E6%AD%A3%E7%BB%8F%E8%AE%B0%E5%BD%95%E9%94%81%E3%80%82%E4%B8%8D%E8%BF%87%E4%B9%8B%E5%90%8E%E5%9C%A8%E5%88%A4%E6%96%AD%E8%BE%B9%E7%95%8C%E6%9D%A1%E4%BB%B6%E6%97%B6%EF%BC%8C%E8%99%BD%E7%84%B6name%E5%80%BC%E4%B8%BA'l%E5%88%98%E5%A4%87'%E7%9A%84%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E8%AE%B0%E5%BD%95%E4%B8%8D%E7%AC%A6%E5%90%88name%20%3C%3D%20'c%E6%9B%B9%E6%93%8D'%E7%9A%84%E8%BE%B9%E7%95%8C%E6%9D%A1%E4%BB%B6%EF%BC%8C**%E4%BD%86%E6%98%AF%E5%9C%A8REPEATABLE%20READ%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%E4%B8%8B%E5%B9%B6%E4%B8%8D%E4%BC%9A%E9%87%8A%E6%94%BE%E8%AF%A5%E8%AE%B0%E5%BD%95%E4%B8%8A%E5%8A%A0%E7%9A%84%E9%94%81**%EF%BC%8C%E6%95%B4%E4%B8%AA%E8%BF%87%E7%A8%8B%E7%9A%84%E5%8A%A0%E9%94%81%E7%A4%BA%E6%84%8F%E5%9B%BE%E5%B0%B1%E6%98%AF%EF%BC%9A%0A!%5B59aed160d85992d21617bbd4c9e53d63.jpeg%5D(en-resource%3A%2F%2Fdatabase%2F1276%3A0)%0A%0A%23%23%23%23%20%E4%BD%BF%E7%94%A8DELETE%E8%AF%AD%E5%8F%A5%E6%9D%A5%E4%B8%BA%E8%AE%B0%E5%BD%95%E5%8A%A0%E9%94%81!%5Bf5fc964a39a17c510f4a2e937baa5f9b.png%5D(en-resource%3A%2F%2Fdatabase%2F1277%3A0)%0A%0A%E5%A6%82%E6%9E%9C%E8%BF%99%E4%B8%A4%E4%B8%AA%E8%AF%AD%E5%8F%A5%E9%87%87%E7%94%A8%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E6%9D%A5%E8%BF%9B%E8%A1%8C%E9%94%81%E5%AE%9A%E8%AF%BB%EF%BC%8C%E9%82%A3%E4%B9%88%E5%AE%83%E4%BB%AC%E7%9A%84%E5%8A%A0%E9%94%81%E6%83%85%E5%86%B5%E5%92%8C%E6%9B%B4%E6%96%B0%E5%B8%A6%E6%9C%89%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E5%88%97%E7%9A%84UPDATE%E8%AF%AD%E5%8F%A5%E4%B8%80%E8%87%B4%EF%BC%8C%E5%B0%B1%E4%B8%8D%E7%94%BB%E5%9B%BE%E4%BA%86%E3%80%82%0A%0A%23%23%23%202-2-5%20%E5%AF%B9%E6%99%AE%E9%80%9A%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E8%BF%9B%E8%A1%8C%E7%AD%89%E5%80%BC%E6%9F%A5%E8%AF%A2%0A%0A%E6%88%91%E4%BB%AC%E5%86%8D%E6%8A%8A%E4%B8%8A%E8%BE%B9%E7%9A%84%E5%94%AF%E4%B8%80%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95uk_name%E6%94%B9%E5%9B%9E%E6%99%AE%E9%80%9A%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95idx_name%EF%BC%9A%0AALTER%20TABLE%20hero%20DROP%20INDEX%20uk_name%2C%20ADD%20INDEX%20idx_name%20(name)%EF%BC%9B%0A%0A%23%23%23%23%20%E4%BD%BF%E7%94%A8SELECT%20...%20LOCK%20IN%20SHARE%20MODE%E8%AF%AD%E5%8F%A5%E6%9D%A5%E4%B8%BA%E8%AE%B0%E5%BD%95%E5%8A%A0%E9%94%81%0A%E4%BE%8B%EF%BC%9A%0ASELECT%20*%20FROM%20hero%20W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%93%8D'%E7%9A%84%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E8%AE%B0%E5%BD%95%E7%9A%84**%E4%B8%8B%E4%B8%80%E6%9D%A1%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E8%AE%B0%E5%BD%95%E5%8A%A0gap%E9%94%81**%EF%BC%9B%0A!%5B1a96931f63ffbfe22bf92e6e26b27f6f.jpeg%5D(en-resource%3A%2F%2Fdatabase%2F1278%3A0)%0A%0A%E5%A6%82%E6%9E%9C%E5%AF%B9%E6%99%AE%E9%80%9A%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E7%AD%89%E5%80%BC%E6%9F%A5%E8%AF%A2%E7%9A%84%E5%80%BC%E5%B9%B6%E4%B8%8D%E5%AD%98%E5%9C%A8%EF%BC%8C%E6%AF%94%E5%A6%82%EF%BC%9A%0ASELECT%20*%20FROM%20hero%20WHERE%20name%20%3D%20'g%E5%85%B3%E7%BE%BD'%20LOCK%20IN%20SHARE%20MODE%EF%BC%9B%0A%0A%0A%E5%8A%A0%E9%94%81%E6%96%B9%E5%BC%8F%E5%92%8C%E6%88%91%E4%BB%AC%E4%B8%8A%E8%BE%B9%E5%94%A0%E5%8F%A8%E8%BF%87%E7%9A%84%E5%94%AF%E4%B8%80%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E7%9A%84%E6%83%85%E5%86%B5%E6%98%AF%E4%B8%80%E6%A0%B7%E7%9A%84%EF%BC%8C%E5%B0%B1%E4%B8%8D%E8%B5%98%E8%BF%B0%E4%BA%86%E3%80%82%EF%BC%88**Gap%E9%94%81**%EF%BC%89%0A%0A%23%23%23%23%20%E4%BD%BF%E7%94%A8SELECT%20...%20FOR%20UPDATE%E8%AF%AD%E5%8F%A5%E6%9D%A5%E4%B8%BA%E8%AE%B0%E5%BD%95%E5%8A%A0%E9%94%81%0A%0A%E5%92%8CSELECT%20...%20LOCK%20IN%20SHARE%20MODE%E8%AF%AD%E5%8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E8%BF%99%E6%9D%A1%E8%AE%B0%E5%BD%95%E5%8A%A0%E9%94%81%E4%B8%80%E4%B8%AAS%E5%9E%8Bnext-key%E9%94%81%EF%BC%8C%E7%84%B6%E5%90%8E%E8%BF%94%E5%9B%9E%E7%BB%99server%E5%B1%82%EF%BC%8C%E5%A6%82%E6%9E%9Cserver%E5%B1%82%E5%88%A4%E6%96%ADcountry%20%3D%20'%E9%AD%8F'%E8%BF%99%E4%B8%AA%E6%9D%A1%E4%BB%B6%E6%98%AF%E5%90%A6%E6%88%90%E7%AB%8B%EF%BC%8C%E5%A6%82%E6%9E%9C%E6%88%90%E7%AB%8B%E5%88%99%E5%B0%86%E5%85%B6%E5%8F%91%E9%80%81%E7%BB%99%E5%AE%A2%E6%88%B7%E7%AB%AF%EF%BC%8C%E5%90%A6%E5%88%99%E4%BC%9A%E5%90%91InnoDB%E5%AD%98%E5%82%A8%E5%BC%95%E6%93%8E%E5%8F%91%E9%80%81%E9%87%8A%E6%94%BE%E6%8E%89%E8%AF%A5%E8%AE%B0%E5%BD%95%E4%B8%8A%E7%9A%84%E9%94%81%E7%9A%84%E6%B6%88%E6%81%AF%EF%BC%8C%E4%B8%8D%E8%BF%87**%E5%9C%A8REPEATABLE%20READ%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%E4%B8%8B%EF%BC%8CInnoDB%E5%AD%98%E5%82%A8%E5%BC%95%E6%93%8E%E5%B9%B6%E4%B8%8D%E4%BC%9A%E7%9C%9F%E6%AD%A3%E7%9A%84%E9%87%8A%E6%94%BE%E6%8E%89%E9%94%81%EF%BC%8C%E6%89%80%E4%BB%A5%E8%81%9A%E7%B0%87%E7%B4%A2%E5%BC%95%E7%9A%84%E5%85%A8%E9%83%A8%E8%AE%B0%E5%BD%95%E9%83%BD%E4%BC%9A%E8%A2%AB%E5%8A%A0%E9%94%81%EF%BC%8C%E5%B9%B6%E4%B8%94%E5%9C%A8%E4%BA%8B%E5%8A%A1%E6%8F%90%E4%BA%A4%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E6%97%B6%E5%80%99%E4%B9%9F%E9%9C%80%E8%A6%81%E5%9C%A8%E5%86%85%E5%AD%98%E4%B8%AD%E7%94%9F%E6%88%90%E4%B8%80%E4%B8%AA**%E9%94%81%E7%BB%93%E6%9E%84**%EF%BC%8C%E8%A1%A8%E6%98%8E%E6%9C%89%E4%BA%8B%E5%8A%A1%E6%83%B3%E5%9C%A8%E6%9F%90%E4%B8%AA**%E9%97%B4%E9%9A%99**%E4%B8%AD%E6%8F%92%E5%85%A5%E6%96%B0%E8%AE%B0%E5%BD%95%EF%BC%8C%E4%BD%86%E6%98%AF%E7%8E%B0%E5%9C%A8%E5%9C%A8%E7%AD%89%E5%BE%85%EF%BC%8C%E8%BF%99%E7%A7%8D%E7%B1%BB%E5%9E%8B%E7%9A%84%E9%94%81%E7%A7%B0%E4%B8%BA**Insert%20Intention%20Locks**%EF%BC%8C%E5%AE%98%E6%96%B9%E7%9A%84%E7%B1%BB%E5%9E%8B%E5%90%8D%E7%A7%B0%E4%B8%BA%EF%BC%9A**LOCK_INSERT_INTENTION**%EF%BC%8C%E4%B9%9F%E5%8F%AF%E4%BB%A5%E7%A7%B0%E4%B8%BA**%E6%8F%92%E5%85%A5%E6%84%8F%E5%90%91%E9%94%81**%E3%80%82%0A%0A%0A%E6%AF%94%E6%96%B9%E8%AF%B4%E6%88%91%E4%BB%AC%E6%8A%8Anumber%E5%80%BC%E4%B8%BA8%E7%9A%84%E9%82%A3%E6%9D%A1%E8%AE%B0%E5%BD%95%E5%8A%A0%E4%B8%80%E4%B8%AA%E6%8F%92%E5%85%A5%E6%84%8F%E5%90%91%E9%94%81%E7%9A%84%E7%A4%BA%E6%84%8F%E5%9B%BE%E5%A6%82%E4%B8%8B%EF%BC%9A%0A!%5B545ce68426a03ddf21a812b629150f58.jpeg%5D(en-resource%3A%2F%2Fdatabase%2F1281%3A0)%0A%0A%0A%E4%B8%BA%E4%BA%86%E8%AE%A9%E5%A4%A7%E5%AE%B6%E5%BD%BB%E5%BA%95%E7%90%86%E8%A7%A3%E8%BF%99%E4%B8%AA%E6%8F%92%E5%85%A5%E6%84%8F%E5%90%91%E9%94%81%E7%9A%84%E5%8A%9F%E8%83%BD%EF%BC%8C%E6%88%91%E4%BB%AC%E8%BF%98%E6%98%AF%E4%B8%BE%E4%B8%AA%E4%BE%8B%E5%AD%90%E7%84%B6%E5%90%8E%E7%94%BB%E4%B8%AA%E5%9B%BE%E8%A1%A8%E7%A4%BA%E4%B8%80%E4%B8%8B%E3%80%82%E6%AF%94%E6%96%B9%E8%AF%B4%E7%8E%B0%E5%9C%A8T1%E4%B8%BAnumber%E5%80%BC%E4%B8%BA8%E7%9A%84%E8%AE%B0%E5%BD%95%E5%8A%A0%E4%BA%86%E4%B8%80%E4%B8%AAgap%E9%94%81%EF%BC%8C%E7%84%B6%E5%90%8ET2%E5%92%8CT3%E5%88%86%E5%88%AB%E6%83%B3%E5%90%91hero%E8%A1%A8%E4%B8%AD%E6%8F%92%E5%85%A5number%E5%80%BC%E5%88%86%E5%88%AB%E4%B8%BA4%E3%80%815%E7%9A%84%E4%B8%A4%E6%9D%A1%E8%AE%B0%E5%BD%95%EF%BC%8C%E6%89%80%E4%BB%A5%E7%8E%B0%E5%9C%A8%E4%B8%BAnumber%E5%80%BC%E4%B8%BA8%E7%9A%84%E8%AE%B0%E5%BD%95%E5%8A%A0%E7%9A%84%E9%94%81%E7%9A%84%E7%A4%BA%E6%84%8F%E5%9B%BE%E5%B0%B1%E5%A6%82%E4%B8%8B%E6%89%80%E7%A4%BA%EF%BC%9A%0A!%5B58cca45819393ad734ddc10b155414bb.jpeg%5D(en-resource%3A%2F%2Fdatabase%2F1282%3A0)%0A%0A%0A%E4%BB%8E%E5%9B%BE%E4%B8%AD%E5%8F%AF%E4%BB%A5%E7%9C%8B%E5%88%B0%EF%BC%8C%E7%94%B1%E4%BA%8ET1%E6%8C%81%E6%9C%89gap%E9%94%81%EF%BC%8C%E6%89%80%E4%BB%A5T2%E5%92%8CT3%E9%9C%80%E8%A6%81%E7%94%9F%E6%88%90%E4%B8%80%E4%B8%AA%E6%8F%92%E5%85%A5%E6%84%8F%E5%90%91%E9%94%81%E7%9A%84%E9%94%81%E7%BB%93%E6%9E%84%E5%B9%B6%E4%B8%94%E5%A4%84%E4%BA%8E%E7%AD%89%E5%BE%85%E7%8A%B6%E6%80%81%E3%80%82%E5%BD%93T1%E6%8F%90%E4%BA%A4%E5%90%8E%E4%BC%9A%E6%8A%8A%E5%AE%83%E8%8E%B7%E5%8F%96%E5%88%B0%E7%9A%84%E9%94%81%E9%83%BD%E9%87%8A%E6%94%BE%E6%8E%89%EF%BC%8C%E8%BF%99%E6%A0%B7T2%E5%92%8CT3%E5%B0%B1%E8%83%BD%E8%8E%B7%E5%8F%96%E5%88%B0%E5%AF%B9%E5%BA%94%E7%9A%84%E6%8F%92%E5%85%A5%E6%84%8F%E5%90%91%E9%94%81%E4%BA%86%EF%BC%88%E6%9C%AC%E8%B4%A8%E4%B8%8A%E5%B0%B1%E6%98%AF%E6%8A%8A%E6%8F%92%E5%85%A5%E6%84%8F%E5%90%91%E9%94%81%E5%AF%B9%E5%BA%94%E9%94%81%E7%BB%93%E6%9E%84%E7%9A%84is_waiting%E5%B1%9E%E6%80%A7%E6%94%B9%E4%B8%BAfalse%EF%BC%89%EF%BC%8CT2%E5%92%8CT3%E4%B9%8B%E9%97%B4%E4%B9%9F%E5%B9%B6%E4%B8%8D%E4%BC%9A%E7%9B%B8%E4%BA%92%E9%98%BB%E5%A1%9E%EF%BC%8C%E5%AE%83%E4%BB%AC%E5%8F%AF%E4%BB%A5%E5%90%8C%E6%97%B6%E8%8E%B7%E5%8F%96%E5%88%B0number%E5%80%BC%E4%B8%BA8%E7%9A%84%E6%8F%92%E5%85%A5%E6%84%8F%E5%90%91%E9%94%81%EF%BC%8C%E7%84%B6%E5%90%8E%E6%89%A7%E8%A1%8C%E6%8F%92%E5%85%A5%E6%93%8D%E4%BD%9C%E3%80%82%E4%BA%8B%E5%AE%9E%E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%B3%95%E3%80%82%0A%0A%23%23%20-------------------------------------------------%0A%E9%80%9A%E8%BF%87%E4%B8%8A%E8%BE%B9%E7%9A%84%E5%8F%99%E8%BF%B0%E6%88%91%E4%BB%AC%E7%9F%A5%E9%81%93%EF%BC%8C%E4%B8%80%E4%B8%AA%E4%BA%8B%E5%8A%A1%E5%AF%B9%E6%96%B0%E6%8F%92%E5%85%A5%E7%9A%84%E8%AE%B0%E5%BD%95%E5%8F%AF%E4%BB%A5%E4%B8%8D%E6%98%BE%E5%BC%8F%E7%9A%84%E5%8A%A0%E9%94%81%EF%BC%88%E7%94%9F%E6%88%90%E4%B8%80%E4%B8%AA%E9%94%81%E7%BB%93%E6%9E%84%EF%BC%89%EF%BC%8C%E4%BD%86%E6%98%AF%E7%94%B1%E4%BA%8E%E4%BA%8B%E5%8A%A1id%E8%BF%99%E4%B8%AA%E7%89%9B%E9%80%BC%E7%9A%84%E4%B8%9C%E4%B8%9C%E7%9A%84%E5%AD%98%E5%9C%A8%EF%BC%8C%E7%9B%B8%E5%BD%93%E4%BA%8E%E5%8A%A0%E4%BA%86%E4%B8%80%E4%B8%AA%E9%9A%90%E5%BC%8F%E9%94%81%E3%80%82%E5%88%AB%E7%9A%84%E4%BA%8B%E5%8A%A1%E5%9C%A8%E5%AF%B9%E8%BF%99%E6%9D%A1%E8%AE%B0%E5%BD%95%E5%8A%A0S%E9%94%81%E6%88%96%E8%80%85X%E9%94%81%E6%97%B6%EF%BC%8C%E7%94%B1%E4%BA%8E%E9%9A%90%E5%BC%8F%E9%94%81%E7%9A%84%E5%AD%98%E5%9C%A8%EF%BC%8C%E4%BC%9A%E5%85%88%E5%B8%AE%E5%8A%A9%E5%BD%93%E5%89%8D%E4%BA%8B%E5%8A%A1%E7%94%9F%E6%88%90%E4%B8%80%E4%B8%AA%E9%94%81%E7%BB%93%E6%9E%84%EF%BC%8C%E7%84%B6%E5%90%8E%E8%87%AA%E5%B7%B1%E5%86%8D%E7%94%9F%E6%88%90%E4%B8%80%E4%B8%AA%E9%94%81%E7%BB%93%E6%9E%84%E5%90%8E%E8%BF%9B%E5%85%A5%E7%AD%89%E5%BE%85%E7%8A%B6%E6%80%81%E3%80%82%0A%0A%E4%B8%8B%E8%BE%B9%E8%A6%81%E7%9C%8B%E7%9A%84%E6%98%AF%E4%B8%A4%E7%A7%8DINSERT%E8%AF%AD%E5%8F%A5%E9%81%87%E5%88%B0%E7%9A%84%E7%89%B9%E6%AE%8A%E6%83%85%E5%86%B5%EF%BC%9A%0A%0A%23%23%23%23%20%E9%81%87%E5%88%B0%E9%87%8D%E5%A4%8D%E9%94%AE%EF%BC%88duplicate%20key%EF%BC%89%0A%0A%E5%9C%A8%E6%8F%92%E5%85%A5%E4%B8%80%E6%9D%A1%E6%96%B0%E8%AE%B0%E5%BD%95%E6%97%B6%EF%BC%8C%E9%A6%96%E5%85%88%E8%A6%81%E5%81%9A%E7%9A%84%E4%BA%8B%E6%83%85%E5%85%B6%E5%AE%9E%E6%98%AF%E5%AE%9A%E4%BD%8D%E5%88%B0%E8%BF%99%E6%9D%A1%E6%96%B0%E8%AE%B0%E5%BD%95%E5%BA%94%E8%AF%A5%E6%8F%92%E5%85%A5%E5%88%B0B%2B%E6%A0%91%E7%9A%84%E5%93%AA%E4%B8%AA%E4%BD%8D%E7%BD%AE%E3%80%82%E5%A6%82%E6%9E%9C%E5%AE%9A%E4%BD%8D%E4%BD%8D%E7%BD%AE%E6%97%B6%E5%8F%91%E7%8E%B0%E4%BA%86%E6%9C%89%E5%B7%B2%E5%AD%98%E5%9C%A8%E8%AE%B0%E5%BD%95%E7%9A%84%E4%B8%BB%E9%94%AE%E6%88%96%E8%80%85%E5%94%AF%E4%B8%80%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E5%88%97%E4%B8%8E%E5%BE%85%E6%8F%92%E5%85%A5%E8%AE%B0%E5%BD%95%E7%9A%84%E4%B8%BB%E9%94%AE%E6%88%96%E8%80%85%E5%94%AF%E4%B8%80%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E5%88%97%E7%9B%B8%E5%90%8C%EF%BC%88%E4%B8%8D%E8%BF%87%E5%8F%AF%E4%BB%A5%E6%9C%89%E5%A4%9A%E6%9D%A1%E8%AE%B0%E5%BD%95%E7%9A%84%E5%94%AF%E4%B8%80%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E5%88%97%E7%9A%84%E5%80%BC%E5%90%8C%E6%97%B6%E4%B8%BANULL%EF%BC%89%EF%BC%8C%E9%82%A3%E4%B9%88%E6%AD%A4%E6%97%B6%E6%AD%A4%E6%97%B6%E6%98%AF%E4%BC%9A%E6%8A%A5%E9%94%99%E7%9A%84%E3%80%82%0A%0A*%20**%E4%B8%BB%E9%94%AE%E7%B4%A2%E5%BC%95%E9%87%8D%E5%A4%8D**%0A%0A%E6%AF%94%E6%96%B9%E8%AF%B4%E6%88%91%E4%BB%AC%E6%8F%92%E5%85%A5%E6%96%B0%E8%AE%B0%E5%BD%95%EF%BC%8C%E8%AF%A5%E8%AE%B0%E5%BD%95%E7%9A%84%E4%B8%BB%E9%94%AE%E5%80%BC%E5%B7%B2%E7%BB%8F%E8%A2%AB%E5%8C%85%E5%90%AB%E5%9C%A8hero%E8%A1%A8%E4%B8%AD%E4%BA%86%EF%BC%9A!%5Bbe3359175be8d3dde76da000f43f2aab.png%5D(en-resource%3A%2F%2Fdatabase%2F1285%3A0)%0A%0A%E5%BD%93%E7%84%B6%EF%BC%8C%E5%9C%A8%E7%94%9F%E6%88%90%E6%8A%A5%E9%94%99%E4%BF%A1%E6%81%AF%E5%89%8D%EF%BC%8C%E5%85%B6%E5%AE%9E%E8%BF%98%E9%9C%80%E8%A6%81%E5%81%9A%E4%B8%80%E4%BB%B6%E9%9D%9E%E5%B8%B8%E9%87%8D%E8%A6%81%E7%9A%84%E4%BA%8B%E6%83%85%20%E2%80%94%E2%80%94%C2%A0**%E6%97%A0%E8%AE%BA%E6%98%AF%E5%93%AA%E7%A7%8D%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%EF%BC%8C%E5%AF%B9%E8%81%9A%E7%B0%87%E7%B4%A2%E5%BC%95%E4%B8%ADnumber%E5%80%BC%E4%B8%BA20%E7%9A%84%E9%82%A3%E6%9D%A1%E8%AE%B0%E5%BD%95%E5%8A%A0S%E5%9E%8BRecord%20Locks**%E3%80%82%0A%0A*%20**%E5%94%AF%E4%B8%80%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E9%87%8D%E5%A4%8D**%0A%E5%9C%A8**READ%20UNCOMMITTED%2FREAD%20COMMITTED**%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%E4%B8%8B%EF%BC%8C%E5%8A%A0%E7%9A%84%E6%98%AF**S%E5%9E%8BRecord%20Locks**%E3%80%82%0A%E5%9C%A8**REPEATABLE%20READ%2FSERIALIZABLE**%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%E4%B8%8B%EF%BC%8C%E5%8A%A0%E7%9A%84%E6%98%AF**S%E5%9E%8Bnext-key%E9%94%81**%E3%80%82%0A%0A%23%23%23%23%20%E5%A4%96%E9%94%AE%E6%A3%80%E6%9F%A5%0A%0A%0A%E5%A4%A7%E5%AE%B6%E5%88%AB%E5%BF%98%E4%BA%86MySQL%E8%BF%98%E6%98%AF%E4%B8%80%E4%B8%AA%E6%94%AF%E6%8C%81%E5%A4%96%E9%94%AE%E7%9A%84%E6%95%B0%E6%8D%AE%E5%BA%93%EF%BC%8C%E6%AF%94%E6%96%B9%E8%AF%B4%E6%88%91%E4%BB%AC%E5%86%8D%E4%B8%BA%E4%B8%89%E5%9B%BD%E8%8B%B1%E9%9B%84%E7%9A%84%E6%88%98%E9%A9%AC%E5%BB%BA%E4%B8%80%E4%B8%AA%E8%A1%A8%EF%BC%9A!%5B91422c58cc16d35fd0e9cae0abc06e0e.png%5D(en-resource%3A%2F%2Fdatabase%2F1283%3A0)%0A%0A%E8%BF%99%E6%A0%B7hero%E8%A1%A8%E5%B0%B1%E7%AE%97%E6%98%AF%E4%B8%80%E4%B8%AA%E7%88%B6%E8%A1%A8%EF%BC%8C%E6%96%B0%E5%BB%BA%E7%9A%84horse%E8%A1%A8%E5%B0%B1%E7%AE%97%E4%B8%80%E4%B8%AA%E5%AD%90%E8%A1%A8%EF%BC%8C%E5%85%B6%E4%B8%ADhorse%E8%A1%A8%E7%9A%84number%E5%88%97%E6%98%AF%E5%8F%82%E7%85%A7hero%E8%A1%A8%E7%9A%84number%E5%88%97%E3%80%82%E7%8E%B0%E5%9C%A8%E5%A6%82%E6%9E%9C%E6%88%91%E4%BB%AC%E5%90%91%E5%AD%90%E8%A1%A8%E4%B8%AD%E6%8F%92%E5%85%A5%E4%B8%80%E6%9D%A1%E8%AE%B0%E5%BD%95%E6%97%B6%EF%BC%9A%0A!%5Ba3161ccea29c4d6e7269590a22c308d3.png%5D(en-resource%3A%2F%2Fdatabase%2F1284%3A0)%0A!%5B2d730d13c9ffc163323b91209722066c.png%5D(en-resource%3A%2F%2Fdatabase%2F1280%3A0)%0A%0A%0A%23%23%20%E5%B0%8F%E7%BB%93%0A1.%20%E5%9C%A8%E8%BF%9B%E8%A1%8C%E8%8C%83%E5%9B%B4%E6%9F%A5%E8%AF%A2%E6%97%B6%EF%BC%8C%E5%AF%B9%E4%BA%8E%E9%9D%9E%E4%B8%BB%E9%94%AE%E7%B4%A2%E5%BC%95%EF%BC%8C%E9%9C%80%E8%A6%81%E4%BD%BF%E7%94%A8%E5%88%B0**%E7%B4%A2%E5%BC%95%E6%9D%A1%E4%BB%B6%E4%B8%8B%E6%8E%A8**%E7%9A%84%E7%89%B9%E6%80%A7%EF%BC%9B%0A2.%20%E5%AF%B9%E4%BA%8E**Repeatable%20Read%2FSerializable**%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%E4%B8%8B%EF%BC%8C%E4%BD%BF%E7%94%A8**%E7%B4%A2%E5%BC%95%E6%9D%A1%E4%BB%B6%E4%B8%8B%E6%8E%A8**%E6%97%B6%EF%BC%8C%E4%B8%8D%E6%BB%A1%E8%B6%B3%E4%B8%8B%E6%8E%A8%E6%9D%A1%E4%BB%B6%E7%9A%84%E8%AE%B0%E5%BD%95%EF%BC%8C%E5%B9%B6%E4%B8%8D%E9%87%8A%E6%94%BE%E9%94%81%EF%BC%9B%0A3.%20%E5%AF%B9%E4%BA%8E**Repeatable%20Read%2FSerializable**%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%E4%B8%8B%EF%BC%8C%E5%AF%B9%E4%BA%8E%E6%9C%89%E6%9D%A1%E4%BB%B6%E4%B8%8A%E9%99%90%E5%88%A4%E6%96%AD%E7%9A%84%E8%AF%AD%E5%8F%A5%EF%BC%8C%E6%9C%80%E5%90%8E%E4%B8%80%E4%B8%AA%E6%BA%A2%E5%87%BA%E5%88%A4%E6%96%AD%E7%9A%84%E8%AE%B0%E5%BD%95%EF%BC%8C%E4%B8%8D%E9%87%8A%E6%94%BE%E5%85%B6%E9%94%81%EF%BC%9B%0A4.%20%E5%AF%B9%E5%85%A8%E8%A1%A8%E6%89%AB%E6%8F%8F%E7%9A%84%E6%83%85%E5%86%B5%EF%BC%8C**Read%20Uncommitted%2FRead%20Committed**%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%E4%B8%8B%EF%BC%8C%E5%9C%A8%E8%BF%9B%E8%A1%8C%E8%BE%B9%E7%95%8C%E6%9D%A1%E4%BB%B6%E5%88%A4%E6%96%AD%E5%90%8E%EF%BC%8C%E4%BC%9A%E5%B0%86%E4%B8%8D%E6%BB%A1%E8%B6%B3%E6%9D%A1%E4%BB%B6%E7%9A%84%E8%AE%B0%E5%BD%95%E7%9A%84%E9%94%81%E9%87%8A%E6%94%BE%E6%8E%89%EF%BC%9B%E5%AF%B9%E4%BA%8E**Repeatable%20Read%2FSerializable**%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%E4%B8%8B%EF%BC%8C%E4%B8%8D%E4%BC%9A%E8%BF%9B%E8%A1%8C%E8%BE%B9%E7%95%8C%E6%9D%A1%E4%BB%B6%E5%88%A4%E6%96%AD%EF%BC%8C%E7%9B%B4%E6%8E%A5%E5%AF%B9%E8%A1%A8%E4%B8%AD%E6%89%80%E6%9C%89%E8%AE%B0%E5%BD%95%E5%8A%A0%0A5.%20%E5%AF%B9%E4%BA%8E**update%2Fdelete**%E6%93%8D%E4%BD%9C%EF%BC%8C%E9%9C%80%E8%A6%81%E5%B0%86%E6%93%8D%E4%BD%9C%E7%9B%B8%E5%85%B3%E8%81%94%E7%9A%84%E5%85%B6%E4%BB%96%E7%B4%A2%E5%BC%95%E8%AE%B0%E5%BD%95%E4%B9%9F%E4%B8%8A%E9%94%81%EF%BC%9B%0A6.%20%E5%8F%AA%E6%9C%89**Repeatable%20Read%2FSerializable**%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%E4%B8%8B%EF%BC%8C%E6%89%8D%E5%AD%98%E5%9C%A8**Next-Key%20Locks%2FGap%20Locks**%EF%BC%8C%E5%B9%B6%E4%B8%94%E5%8F%AA%E5%AF%B9**INSERT%E6%93%8D%E4%BD%9C**%E6%9C%89%E9%99%90%E5%88%B6%E4%BD%9C%E7%94%A8%EF%BC%8C%E5%85%B6%E4%BB%96%E6%93%8D%E4%BD%9C%E5%9C%A8%E8%8E%B7%E5%8F%96Gap%E9%94%81%E6%97%B6%E4%B8%8D%E5%86%B2%E7%AA%81%E3%80%82</center></span>
</div></body></html> 